android - save the radiobutton and check -


i need one..

i'm facing difficult in checks radio button.

my concept how save radio button in arraylist , again how check selected value arraylist. if suppose imagine quiz app. have set of questions , answers in separate array. i'm displaying it.its fine. if came pervious question should check selected answer has stored in arraylist. likewise next question. how implement this? feel difficult in this.

when 1st question displays check , answer this..

btn_practicerg.setoncheckedchangelistener(new oncheckedchangelistener(){     @override     public void oncheckedchanged(radiogroup group, int checkedid) {                  radiobutton radiobutton = (radiobutton)group. findviewbyid(checkedid);     string temp = radiobutton.gettext().tostring(); 

when press next button next question like same , answer in string , while press previous have used same that.. should not instead should check choosen answer..

sorry bad english. lot in advance..

  radiogroup = (radiogroup) findviewbyid(r.id.rdbgp1);   radiogroup.setoncheckedchangelistener(new radiogroup.oncheckedchangelistener() {                 @override public void oncheckedchanged(radiogroup group, int checkedid)            { // todo auto-generated method stub for(int i=0;                   radiobutton btn = (radiobutton) radiogroup.getchildat(i);                     string text;                                     if (btn.ispressed() && btn.ischecked() && questno < 5)                   {                        log.e("corrans[questno]",corrans[questno]);                   if (corrans[questno].equals(btn.gettext()) && flag==true)                  {                  score++;                  flag=false;                  checked = true;                   }                  else if(checked==true)                  {                  score--;                  flag=true;                  checked = false;                  }                      }              } tvscore.settext("score: " + integer.tostring(score) + "/5"); log.e("score:", integer.tostring(score)); } }); 

this snippet can go ahead , modify according need... hope check link


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -