Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Java Code Question.

Options
  • 21-09-2010 9:34pm
    #1
    Closed Accounts Posts: 6,408 ✭✭✭


    Ok I started using Java this evening for the first time. I've used C and C++ a little and Java and Eclipse are really great to work with. I love the way I don't need to declare loads of stuff at the start.

    Anyway, I'm going over an example currency convertor program and I have two questions:
    public void onCreate(Bundle icicle) {
            super.onCreate(icicle);
            setContentView(R.layout.main);
            
            dollars = (TextView)this.findViewById(R.id.dollars);
            euros = (TextView)this.findViewById(R.id.euros);
            
            dtoe = (RadioButton)this.findViewById(R.id.dtoe);
            dtoe.setChecked(true);
            etod = (RadioButton)this.findViewById(R.id.etod);
            
            convert = (Button)this.findViewById(R.id.convert);
            convert.setOnClickListener(this);
            }
    

    In the code above I'm wondering how I can set it up so I can toggle the radio buttons either from one to the other and each one on and off. I guess it's around the setChecked(true) event thingy, event handler? I dunno...

    Secondly, I'm wondering what icicle is? As in (Bundle icicle) and onCreate(icicle).

    Thanks.

    More questions coming soon on the Native Development Kit.


Comments

  • Registered Users Posts: 7,814 ✭✭✭TPD


    RadioButtons need to be added to a RadioGroup before they'll interact with each other, allowing only one to be checked at a time.

    http://developer.android.com/resources/tutorials/views/hello-formstuff.html#RadioButtons

    Haven't a clue about that icicle thing :P


  • Registered Users Posts: 18,272 ✭✭✭✭Atomic Pineapple


    icicle is the Bundle that contains the Activities previously frozen state so that you can recreate it if required.

    For example if you need to change to landscape mode you will save the Bundle in onSaveInstanceState(Bundle) and then you can use the saved Bundle to recreate your Activity.


  • Closed Accounts Posts: 6,408 ✭✭✭studiorat


    draffodx wrote: »
    icicle is the Bundle that contains the Activities previously frozen state so that you can recreate it if required.

    For example if you need to change to landscape mode you will save the Bundle in onSaveInstanceState(Bundle) and then you can use the saved Bundle to recreate your Activity.

    I had a feeling it would be something like that.


    Re: The radio group I'll check that link.

    Thanks.


Advertisement