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

Apps Custom listview layout and simplecursor adaptar.

Ridleyslayer

Lurker
Jan 7, 2015
6
0
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:

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?
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones