There are plenty of questions of how to use CheckedTextView
but I can't make it work correctly.
I have a CursorAdapter
with a custom view which has a CheckedTextView
with android:id="@android:id/text1"
. I have used android:id/text1
because there are different questions that mention that if you use it you will get the choice mode multiple for free.
If I do something like this:
final long[] checkedIds = mListView.getCheckedItemIds();
for ( int i = 0 ; i < mListView.getCheckedItemCount() ; i++ ) {
Log.d(TAG, "id checked: " + checkedIds[i]);
}
I get all the checked ids without an issue, but I can't see any visual feedback in the ListView
.
In other words the logic is fine but when I click the CheckedTextView
The green tick doesn't show up.
I was reading the ListView
src code and I couldn't find any reference to android:id/text1
and makes me wonder if I should handle widget's checked state myself.
Can anyone spot where android:id/text1
is used to make the widget checked or not?
LinearLayout
and implementsCheckable
. Usingandroid:id/text1
is not necessary, you just need your parent view to be checkable. I am now getting duplicated green ticks but that's a different problem. Thanks, Mark! – Christophany