I got the answer for that, we need to increment the for loop till the
end of the list that was displayed.
the right code would be
SparseBooleanArray positions;
> positions = listView.getCheckedItemPositions();
>
>                 int j =0;
>                 selected = new String[size];
>
>                 for(int k =0; k <items.length;k++){
>                     if(positions.get(k)){
>                         selected[j++]=items[k];
>                     }
>
>                 }

On Apr 21, 8:03 pm, raqz <[email protected]> wrote:
> Hi,
>
> I am trying to use the
> android.R.layout.simple_list_item_multiple_choice, with
> CHOICE_MODE_MULTIPLE.
> The contents are being displayed all right. Even if I happen to select
> the items starting from the first item then it works fine. But if in
> case, I select the last item ONLY, the program doesnt store the name
> in the array selected.
> SparseBooleanArray positions;
> positions = listView.getCheckedItemPositions();
>
>                 int j =0;
>                 selected = new String[size];
>
>                 for(int k =0; k < positions.size();k++){
>                     if(positions.get(k)){
>                         selected[j++]=items[k];
>                     }
>
>                 }
>
> Please let me know..
> Thanks
> Raqeeb
>
> --
> 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 
> athttp://groups.google.com/group/android-developers?hl=en

-- 
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

Reply via email to