No onez [?] ? On Wed, Dec 9, 2009 at 10:23 AM, cire <[email protected]> wrote:
> Hi guys, > > I had the following scenario: > -I'm using a list view in multiple choice mode to enable a user to > delete several items he/she has checked, at once. > -When the user clicks the delete button, i do the following; > *get positions of checked items using: myList.getCheckedItemPositions > (); > *Get the items in this position and put them to a list - toDeleteList. > **(QUESTION BASED ON THIS STEP) use myList.setItemChecked(position, > false) to uncheck the list item. > *Remove the items in the "toDeleteList" > > Now, i was "forced" to manually uncheck the list item because of this > - if for example i delete the 1st item (a) of list [a, b, c, d], b > will be checked after the delete ie. for list [b, c, d] - b will > appear checked. > Question is why? Because the SparseBooleanArray returned by > myList.getCheckedItemPositions(); is the same before and after > deleting from the list. > > I thought (i could be wrong) that after removing an item from the list > via the adapter - the CheckedItemPositions array should also change to > reflect the new state of the list > eg. > - for mylist = [a, b, c, d] > - items at position 0 and 3 checked (a &d) > - the checked item positions (mylist.getCheckedItemPositions()) array > has values true for positions 0 and 3 > - If i remove a & d from the list, therefore, mylist = [b,c], > mylist.getCheckedItemPositions() is the same as above - doesn't change > - positions 0 and 3 are checked. > *I was expecting it not to be checked for positions 0 & 3 because the > items at these positions are no longer in the list. > > So, i'm i getting something wrong here (or having the wrong > expectations :) ) ? someone please clarify this.. > Thanks in advance, -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
<<331.gif>>

