How to disable multiple radio buttons in a group on selecting one in android? -
i have radio buttons in listview, every column radio button , checkbox added @ end. user should able select 1 radio button in list shown, tried looking in net can how list radio buttons using adapter has been done me. advance thanks. below code:
@override public view getview(int position, view convertview, viewgroup parent) { // todo auto-generated method stub view view; viewholder holder; int selected; listcollection person = items.get(position); if(convertview == null) { view = minflater.inflate(r.layout.contact_adapter, parent, false); holder = new viewholder(); holder.name = (textview)view.findviewbyid(r.id.user_name); //holder.primary = (radiobutton) view.findviewbyid(r.id.primary_radio); holder.invoice = (checkbox) view.findviewbyid(r.id.checkbox1); holder.radiogroup = (radiogroup) view.findviewbyid(r.id.radio_group); view.settag(holder); } else { view = convertview; holder = (viewholder)view.gettag(); } holder.name.settext(person.text); selected = holder.radiogroup.getcheckedradiobuttonid(); holder.radiogroup.setoncheckedchangelistener(new oncheckedchangelistener() { @override public void oncheckedchanged(radiogroup group, int checkedid) { // todo auto-generated method stub int childcount = group.getchildcount(); (int x = 0; x < childcount; x++) { radiobutton btn = (radiobutton) group.getchildat(x); if (btn.getid() == checkedid) { } } } }); radiobutton button = new radiobutton(context); button.settext("primary"); button.setid(i); holder.radiogroup.addview(button); return view; }
i think answer here
Comments
Post a Comment