samedi 29 octobre 2016

Set checkbox in simple_list_item_checked from Cursor

I am beginner in Android developing.

I have a ListView of type android.R.layout.simple_list_item_checked and I am trying to set the checkbox to value, which is in my Cursor under name "CHECKED". The problem is that I cannot find the id of the checkbox (I have tried android.R.id.checkbox, but it hasn't worked) and I don't know, how to set it based on my Cursor. The cursor is created from SQLite database table, where the "CHECKED" column is BOOLEAN type.

My code, which is not working:

lv.setAdapter(
                new SimpleCursorAdapter(MainActivity.this, android.R.layout.simple_list_item_checked, mCursor,
                        new String[]{"NOTES", "CHECKED"}, new int[]{android.R.id.text1, android.R.id.checkbox}, 0));

Could you help me, please? Thanks in advance.




Aucun commentaire:

Enregistrer un commentaire