Do you have to realize baseadapter yourself? If you offer multiple-choice choice_mode, why not provide a simple implementation?
question:
Use ListView to implement multiple selections, requiring the data source to use LIST<T>, and attempting to use simpleadapter and its own defined CheckBox control cannot get the selected item. It is troublesome to implement a adapter yourself in a class that is not inheriting listactivity.
Answer:
There are several limitations to implementing multiple selections through Arrayadapter using Android.r.layout.simple_list_item_multiple_choice:
1. The class must inherit listactivity
2. The ID of an internally defined ListView must be used, that is, the id attribute of the ListView control must be Android:id= "@id/android:list"
(Note that there are multiple ListView that require the use of @id/android:list, not @+id/android:list or @android:id/list)
3.ListView objects are obtained by means of the Getlistview () method.
Ps:
Using Arrayadapter Simple_multiple_choice to solve the cost of multiple selection is relatively small, if the data source is cursor may be more convenient, but now the data source is List<t>, from the style will be more fixed, You need the T class to implement the ToString () method to control the output copy.