3

I have a Custom List View where each item in the List contains a Radio Button. I want only one Radio Box in the List to be selected. How can do this ? If i place the Radio Group on the layout i inflate, each Radio Button will be added to it own group ?

Kind regards, Mateen

AndroidDev
  • 15,993
  • 29
  • 85
  • 119
  • try this post http://stackoverflow.com/questions/2937581/android-how-to-make-radiogroup-work-correctly-in-a-listview – Ajay Feb 23 '12 at 12:40

2 Answers2

8

U can set the adapter like this...

setListAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_single_choice,android.R.id.text1, names));

Refer this link it may helpfull.. http://www.vogella.de/articles/AndroidListView/article.html

Parag Chauhan
  • 35,760
  • 13
  • 86
  • 95
user1213202
  • 1,305
  • 11
  • 23
1

As you have a custom adapter you can yourself uncheck the previously checked radiobutton when a other list item is selected.

RaphMclee
  • 1,623
  • 13
  • 16