ListView with CHOICE_MODE_MULTIPLE using CheckedText in a custom view

Based on my read of the code, the row has to implement Checkable:

if (mChoiceMode != CHOICE_MODE_NONE && mCheckStates != null) {
    if (child instanceof Checkable) {
        ((Checkable) child).setChecked(mCheckStates.get(position));
    }
}

This works for the stock row layouts for lists with choice mode because the row is a CheckedTextView, which implements Checkable.

So, add the Checkable interface to your custom View, delegating the interface’s methods to the CheckedTextView, and see if that works out.

Leave a Comment