Nov 22, 2010
I have a ListView, which is in singleChoice mode. All I want is to display a RadioButton to the side, that when clicked highlights to say it is selected, and when a different one is clicked that one goes back to unselected and the new one becomes selected. Why is this so hard? This should not be this complicated. I've spent DAYS looking for an appropriate answer to this and I have found nothing, so I'm asking hopefully in a clear and concise manner.
View 1 Replies
My layout for the listview (R.layout.view_orders):
My custom row (R.layout.orders_row):
My onCreate() method:
Now everything underlying works as expected, you click on a radiobutton and through it's tag I can appropriately select that item from the list and manipulate it how I want. However, when the first radio button is clicked, the last one will be selected. Click that same radio button again, and it is now selected as well. Click it once more and nothing happens, both the last and the first are selected. Now I click any other one on the list, it gets selected like expected. Click anyone of the selected radio buttons and nothing happens, the radio button remains selected.
I have tried using the following in onCreate():
And that just shows no radio buttons at all. AWESOME.
Now maybe (read: most likely), I'm just dense and can't figure this out, but I've seen this question asked a lot with no real answer. Lots of references to other tutorials or to the Commonsware guy's book. However, the comments are old now and his repository has changed so much, that those are no longer correct answers.
So, does anyone have any idea how to get the expected functionality out of this? Or failing that, just pass me along the GMail app's source code.