• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Question about setChoiceMode

Jayman

Lurker
Hello! I have made a small app extending Activity, which, in a (main) menu choice pops up a single-choice list. This kind of works, I can choose an item and dismiss the dialog.

In the layout-file, I have a CheckedTextView entry, containing a android:checkMark="?android:attr/listChoiceIndicatorSingle", which seems to be required for radio buttons to appear, but not for the functionality of the list itself. I make the single-choice-list-dialog by making an AlertDialog.Builder and calling "builder.setSingleChoiceItems(adapter, ...".

However, my problem is that when I make a choice, the corresponding button is not "enabled" visually, even though the OnCLick method is properly called.

I suspect I should somehow call setChoiceMode(ListView.CHOICE_MODE_SINGLE); or something, but this is a method of ListView, and I don't have any ListView. There is a getListView() in ListActivity, but my app extends Activity, not ListActivity. I am reluctant to change this, since everything else works just fine...

Any ideas of what I may have done wrong, or where I have misunderstood?

J.
 
can you post some code? Specifically the xml, and where you inflate it and set the listeners.

One thing to try might be to set android:enabled="true" in CheckedTextView's xml, but I'm not sure.

Also, why are you using a CheckedTextView layout if the user can only make a single choice?
 
Back
Top Bottom