I'm using the RadioGroup version of it:
RadioGroup.OnCheckedChangeListener.html

http://code.google.com/android/reference/android/widget/RadioGroup.OnCheckedChangeListener.html

On closer examination of the logcat, and further using my brain I
realised what was going on.
I had updated my function to:

public void onCheckedChanged(RadioGroup group, int checkedId){
        if (group != null){
                mChecked = checkedId;
                if (group == mColorGroup){
                        mColorGroup2.clearCheck();
                }
                else if(group == mColorGroup2) {
                        mColorGroup.clearCheck();
                }
        }
}

Of course, the group is not null, even if I have cleared a checkbox,
so this just results in oncheckchanged being called, and many
instances of the method building up, resulting in:

11-21 19:39:31.976: INFO/dalvikvm(446): Stack overflow, expanding
(0x41049200 to 0x41049000)
11-21 19:39:31.976: WARN/dalvikvm(446): threadid=3: thread exiting
with uncaught exception (group=0x40010e28)
11-21 19:39:31.976: ERROR/AndroidRuntime(446): Uncaught handler:
thread main exiting due to uncaught exception
11-21 19:39:31.976: ERROR/AndroidRuntime(446):
java.lang.NullPointerException

I will have a look later at how to get around this.
Thanks for all your help.

On Nov 21, 7:41 pm, Mark Murphy <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > I wish there was an edit button here!
>
> > How can I perform a null check on an int?
> > If I use
>
> > if (checkedId != null)
> > I get the error "The operator != is undefined for the argument type(s)
> > int, null".
>
> I think onCheckedChanged() is supposed to have a boolean second parameter:
>
> http://code.google.com/android/reference/android/widget/CompoundButto...
>
> --
> Mark Murphy (a Commons Guy)http://commonsware.com
>
> Android Training on the Ranch! -- Mar 16-20, 
> 2009http://www.bignerdranch.com/schedule.shtml
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to