Why is ListView.getCheckedItemPositions() not returning correct values?

前端 未结 15 1959
北海茫月
北海茫月 2020-11-29 06:01

The app has a ListView with multiple-selection enabled, in the UI it works as expected. But when I read the values out using this code:

Log.         


        
15条回答
  •  长情又很酷
    2020-11-29 06:36

    kcoppock is right, you need to use valueAt(), the working code should be

    SparseBooleanArray checkedItems = categorySelector.getCheckedItemPositions();
    if (checkedItems != null) {
        for (int i=0; i

提交回复
热议问题