Calling the Setting Calling () of ListView is a problem. A lot of people ask about it. There are answers but no one is working. Here's an original scenario that results in unexpected results:
listView.setSelection (5); // listView is a ListView & gt; = 6 items in the list int sel = listView.getSelectedItemPosition (); You would expect SL == 5 but in fact it is -1 (which method does not work?)
This is a bug and if not, what are the rules Settings and recovery of selected items?
If you look in the setSelection document, you know:
If the currently selected item sets, in Touch mode, the item will not be selected but it will still be deployed appropriately. If the position of the specified selection is less than 0, then the item will be selected at position 0.
In this way, it is fully understood that it gives 1 item is not selected even if you run this method when you are in touch mode, As you are most likely.
Comments
Post a Comment