javascript - radio button in android - crashes if none selected -


i use code below in android app check selected radio button in radio group, work crashes if none of radio buttons selected.

how wrap in if statement prevent app crashing?

    checkradiobuttonid =    genderrd.getcheckedradiobuttonid();// selected radio button radiogroup     checkedrbvalue =        (radiobutton) findviewbyid(checkradiobuttonid);       // find radio button returned id     radiobuttontext =       checkedrbvalue.gettext().tostring(); 

thanks.

sorry i'm unable compile right try:

if(checkrbvalue != null){  //enter code here.  } 

hope helps. :)


Comments

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -