CheckedListView sparse boolean array

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

Sponsored Links

I am trying to use the
android.R.layout.simple_list_item_multiple_choice, with
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++){


Please let me know..


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. Please help in creating simple text file


I want to create a simple text file in data/data/
test.txt. My code is as follows:

private String CreateFile(Context context){
                FileOutputStream fOut = context.openFileOutput
                return "1";
        catch(Exception e){
                return e.getMessage();

I tried MODE_WORLD_READABLE also, but still gives error like:

can anyone please help............very urgent


2. No focused widget at Activity creation

Hi all,
I was wondering If there is a way for an Activity to be started and,
even if the View contains one or more focusable widgets, no focus is
assigned initially; i.e. the activity view contains two edittext
fields, but when the Activity is started and view inflated, none of
them should have focus: if the user explicitly press directional keys,
the focus is assigned as usual.

Rationale: otherwise, the user sees the first EditText selected, but
there is no oscreen keyboard shown, and could lead to confusion.

Hack: I could create an invisible component that is focusable
initially, and after losing focus becomes unfocusable, and place it on
top of ofter views to get the initial focus. I'm sure there is a
cleaner way to do this.


3. Protecting /system/app packages from extraction

4. Launch native app by mentioning URL with a scheme in browser

5. ListView with addHeaderView Example?

6. Email Application

7. Accessing default "Messaging" settings