0

I have a list view which contains a radio button as its item,my Requirement is to select only single radio button in the listview ,The list view radio button item is dynamicaly populating is there any option to select single radio button at a time
i added following properties ,but no change

ListView.CHOICE_MODE_SINGLE

please help me
RegardsAugustine

augustine
  • 1,022
  • 1
  • 14
  • 20
  • Did you ever find an answer for this? I am stuck with the same problem. I believe you have to enable mode single and implement Checkable, but I can't find a good example. See here: http://stackoverflow.com/questions/7329856/how-to-use-radiogroup-in-listview-custom-adapter – Eugene van der Merwe Jun 17 '12 at 18:14

3 Answers3

3

Here you go.

listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);

It will change your listview's selection mode to single.

Varundroid
  • 9,135
  • 14
  • 63
  • 93
  • I add ListView.CHOICE_MODE_SINGLE in my code, It makes no change. – augustine May 23 '11 at 07:39
  • HMMMMM then there must be something wrong in your code. Can you please add some of your code? so i can take a look and tell you what you are doing wrong. – Varundroid May 23 '11 at 07:58
2

I think that ListView.CHOICE_MODE_SINGLE is actual for row layout android.R.layout.simple_list_item_single_choice (string and radio button) only. I can not find any sample for multicolumn list view with radio button. There are samples with check box, but check box have not SINGLE CHOICE :(

Leonid
  • 21
  • 1
1

follow this link..

This example shows how to use choice mode on a list. This list is in CHOICE_MODE_SINGLE mode, which means the items behave like checkboxes.

Community
  • 1
  • 1
Niranj Patel
  • 32,980
  • 10
  • 97
  • 133