I'm trying to programmatically set the "android:checkMark" attribute on CheckedTextView items I have in a ListView. When running my application I get the following exception:
android.content.res.Resources$NotFoundException: Resource ID #0x101021a
The resource with ID #0x101021a corresponds to android.R.attr.listChoiceIndicatorMultiple, which is exactly the value I am passing to my CheckedTextView:
mCheckedTextView.setCheckMarkDrawable(android.R.attr.listChoiceIndicatorMultiple)
Isn't this the way to do it from Java? I tried (and succeeded) to trigger the desired behaviour from XML layout:
<CheckedTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checkMark="?android:attr/listChoiceIndicatorMultiple"
android:id="@android:id/text1" />
The thing is that I don't know at compile time if it should be
android:checkMark="?android:attr/listChoiceIndicatorMultiple"
or
android:checkMark="?android:attr/listChoiceIndicatorSingle"
Hence, I need to set these values at runtime.