user449689
user449689

Reputation: 3154

RadioButton in ListView

I want to create a ListView with a RadioButton in every row. I'm using a CursorAdapter and I'm binding it in the right way, but I cannot manage correctly the RadioButton. I want that at any moment only one RadioButton to be checked (so when I check one, I would like the one that was checked before to uncheck). Furthermore, when I put the RadioButton on the row, I cannot manage anymore the setOnItemClickListener. Do you know any tutorial that will work for me? Or can you give me any info?

Upvotes: 1

Views: 1832

Answers (1)

Josnidhin
Josnidhin

Reputation: 12504

Sorry for the previous ans I was sleepy I guess. Try the following

setListAdapter(new ResourceCursorAdapter(this, android.R.layout.simple_list_item_single_choice, cursor));

listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);

Upvotes: 2

Related Questions