The following scenario is not uncommon under activity with list view. 1) Long pressed an item to enter multi-selection mode. 2) Select the desired item, then press an action button. For example, delete button. 3) Exit from multi-selection mode (CHOICE_MODE_MULTIPLE) to none-selection mode (CHOICE_MODE_NONE).
I tested the following situation under Android 4.1. 1) Scroll the list view to the end till "Item 1023" is seen. 2) Long press on "Item 1023" to enter action mode. 3) Select "Item 1019" till "Item 1022". Now, total 5 items is selected including "Item 1023" 4) Scroll up the list, till only the last visible item is "Item 1019" 5) Pressed delete button on the top right. 6) Scroll up to the top most. You will realize along the way, certain rows are being selected. It seems that the recycle views's state_activated stage is not being cleared off, when we exit from multi-selection mode. Even though I have the following code @Override public void onDestroyActionMode(ActionMode mode) { // http://stackoverflow.com/questions/9754170/listview-selection-remains-persistent-after-exiting-choice-mode // Using View.post is the key to solve the problem. final ListView listView = MainActivity.this.getListView(); listView.clearChoices(); for (int i = 0, ei = listView.getChildCount(); i < ei; i++) { listView.setItemChecked(i, false); } listView.post(new Runnable() { @Override public void run() { listView.setChoiceMode(ListView.CHOICE_MODE_NONE); } }); actionMode = null; } It doesn't help much. Any workaround on this long standing bug? - http://stackoverflow.com/questions/9754170/listview-selection-remains-persistent-after-exiting-choice-mode - https://groups.google.com/forum/?fromgroups=#!topic/android-developers/TDG9-yP5ddg Is this being reported in Android bug ticketing? Thanks. I include a complete workable code to demonstrate this bug. https://www.dropbox.com/s/t5zgadtz9q61j00/multimode_bug.zip -- -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.