CheckedListView sparse boolean array

by raqz » Thu, 22 Apr 2010 08:03:53 GMT


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

--



CheckedListView sparse boolean array

by raqz » Thu, 22 Apr 2010 10:03:13 GMT


 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;



>


Sponsored Links


Other Threads

1. Advice on buying android phone for development

Hello everyone,
I'm from India and I want to buy an Android phone for developing
applications for it. I shortlisted two phones the SAMSUNG I7500 and
HTC Hero. But the problem is that i7500 doesn't have much support as
its still stuck with cupcake. and with hero i don't know if it
supports debugging. Can anyone help me with it?

Thanks in advance.

-- 

2. Maven Integration for Android Development Tools 0.2.3 Released

On Sun, Mar 28, 2010 at 1:38 PM, Ricardo Gladwell <



> 

3. android.location.Location.distanceTo algorithm

4. BluetoothServerSocket: how to close correctly?

5. android phone as modem

6. How to get License for OpenCore

7. To resize the SurfaceView while playing the video