Вопрос

sorry if there is another question like this but i couldn't find my answer.

I want to know the way to programmatically set a checkbox to state where it is already selected when I populate the ListView. The checkbox is in the Listview and i am using android.R.layout.simple_list_item_multiple_choice.

Any help would be nice, thank you.

Это было полезно?

Решение

There is a method on ListView that you can call to set an item 'checked' state:

for (int i = 0; i < getListAdapter().getCount(); i++) {
    getListView().setItemChecked(i, true);
}
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top