android - How to get radio Button values number -


i making application has list , radio buttons. layout contains of following : list , button .

the list contains of radio buttons. 2 radio buttons. after checking buttons. want make loop reads values of how many in button 1 , how many in button two. how have done far.

        listviewstudenteditabsence country ;              for(int i=0;i<listviewstudentnames.size();i++) {                 country = listviewstudentnames.get(i);                 if (country.getabsence()==1) {                     absence[i] = "1";                 } else {                     absence[i] ="0";                 }             } 

but doesn't seem work.

in customadapter getview() method

int value=0; //globally     radiogroup radiogroup = (radiogroup) convertview.findviewbyid(r.id.yourradiogroup);                 radiogroup.setoncheckedchangelistener(new oncheckedchangelistener()          {             @override             public void oncheckedchanged(radiogroup group, int checkedid) {                 // checkedid radiobutton selected                   if (checkedid == r.id.rbutton1) {                     value=10;  //a's value                 } else if (checkedid == r.id.rbutton2) {                     value=20; //b's value                 }             }         }); 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -