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. Sending Email from my application in emulator

I have tried with the following code ,but i got an error message"NO 
applications can perform this action".


Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_EMAIL, mailto);
sendIntent.putExtra(Intent.EXTRA_SUBJECT,
subject.getText().toString());
sendIntent.putExtra(Intent.EXTRA_TEXT,
body.getText().toString());
sendIntent.setType("text/plain");

startActivity(Intent.createChooser(sendIntent, "MySendMail"));

Can anybody tell me, the solution for this ?

I have tried to send an email using SMTP server (Gmail), but i got an error
"java.lang.verifyError:javax.mail.internet.Mimemessage."


--~--~---------~--~----~------------~-------~--~----~

2. What is the query that need to be done when trying to get Incomming and Outgoing calls ?

HI I am using the getContentResolverquery function :

public final Cursor query (Uri uri, String[] projection, String
selection, String[] selectionArgs, String sortOrder)
Query the given URI, returning a Cursor over the result set.

Parameters
uri  The URI, using the content:// scheme, for the content to
retrieve.
projection  A list of which columns to return. Passing null will
return all columns, which is discouraged to prevent reading data from
storage that isn't going to be used.
selection  A filter declaring which rows to return, formatted as an
SQL WHERE clause (excluding the WHERE itself). Passing null will
return all rows for the given URI.
selectionArgs  You may include ?s in selection, which will be replaced
by the values from selectionArgs, in the order that they appear in the
selection. The values will be bound as Strings.
sortOrder  How to order the rows, formatted as an SQL ORDER BY clause
(excluding the ORDER BY itself). Passing null will use the default
sort order, which may be unordered.


What is the filter that need to be used to try and get the Incomming
+Outgoing calls together in one query ?

Thanks...
Tom

--~--~---------~--~----~------------~-------~--~----~

3. Abnormal thumbnail generated after ending video recording

4. Threaded horizontal scrolling text

5. need help on editText + IME

6. Programatically selection of 3G network connection in G1?

7. Web service calling from andriod