Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Java Code Question.

  • 21-09-2010 09: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, Registered Users 2 Posts: 7,813 ✭✭✭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, Registered Users 2 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