I've this select:
final Cursor cursorConversations = getContentResolver().query(
Uri.parse("content://gmail-ls/conversations/" + Uri.encode(mailAddress)),
null, null, null, BaseColumns._ID + " DESC");
ContentQueryMap mQueryMap
= new ContentQueryMap(cursorConversations, BaseColumns._ID, true, null);
With ContentQueyMap I can cache Cursor data and iterate in it also with the Cursor closed (i need it to boost performance).
Now, I want that the select of the Corsor only retrieve the first fifty rows. The solution of looping for 50 times in mQueryMap.getRows().entrySet()
is not right: I don't want that mQueryMap gets all the rows of the Cursor, but only the first fifty.
Any idea? Does exist a where clause to get only first n rows?
You could do
final Cursor cursorConversations = getContentResolver().query(
Uri.parse("content://gmail-ls/conversations/" + Uri.encode(mailAddress)),
null, null, null, BaseColumns._ID + " DESC " + " LIMIT 5");
"LIMIT x" after your SORT.
Cheers
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With