I have defined an array of checkbox Lists in an application, with a default style for “selectBackgroundColor” (a lovely purple). So, as an example, one list is
checkBoxList[“Projects”]
and to check the third item in the list, I use:
checkBoxList["Projects"].setCheck(2, true);
which then turns purple.
But there are some cases where I want to set the BackgroundColor to, let’s say, yellow.
Not sure how to make use of your example: Your approach works because you take advantage of a change to the list item (assuming a user did the clicking), which triggers a “selected” state. In my use, all the activity is done “manually”, i.e., an item is “checked” based on whether the day is a particular day of the week or of a month. For example:
if (dayOfWeek == 3) {checkBoxList["Projects"].setCheck(2, true);}