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

前端 未结 15 1964
北海茫月
北海茫月 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:29

    I too used the solution gyller suggests that involves "initiating" the listview

    ListView lv = getListView(); for (int i = 0; i < lv.getCount(); i++) { lv.setItemChecked(i, false); }

    before calling getCheckItemPositions(), and it stopped producing erroneous results!

提交回复
热议问题