Greetings, I´d like to know if there is a way to use a simple cursor adapter to use both a custom listview and allow multiple selection, I currently have the following 2 codes working:
And this:
Is there any way to use the custom layout in multiple choice?
Code:
Cursor cursor = dataSourceAdapter.fetchAllEntries();
// The desired columns to be bound
String[] columns = new String[] {"_id", "ASUNTO", "FECHA", "INFO"};
// the XML defined views which the data will be bound to
int[] to = new int[] {
R.id.tvID,
R.id.tvAsunto,
R.id.tvFecha,
R.id.tvInfo
};
dataAdapter = new SimpleCursorAdapter(
this,
R.layout.lvitems,//This is my modified layout.
cursor,
Tasks.COLUMNS,
to,
0);
And this:
Code:
final ListView list = getListView();
list.setItemsCanFocus(false);
//list.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
list.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
// initialize the adapter
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
//android.R.layout.simple_list_item_single_choice,
android.R.layout.simple_list_item_multiple_choice, //
null,
new String[]{DBHelper.C_NAME},
new int[]{android.R.id.text1});
Is there any way to use the custom layout in multiple choice?