Thursday, 15 September 2011

Android Get next batch of sms/mms -


I need to recover the next 20 messages from DB in Android. I use the following code below to the first 20 messages Retrieving:

  Ury Provider = Uri.parse ("Content: // MMS-SMS / Chat /" + threadid); Cursor cursor = contentResolver.query (provider, new string [] {"_ id", "ct_t"}, empty, blank, "_id desc limit 20"); // Then used the id to get the actual message  

This is working fine but I have to get the next 20 threads from the next thread ID and below. I tried to add the selection:

  "_ id & lt; lastmessageId"  

but it gives me a null cursor I have another The solution is to use the code above, but the limit of 20 is increased, but it will return unnecessary rows of data. Can anyone help me with this? ! Thanks

Edit :. I found this in the log

  SQLiteException: (unclear column name: _ id (code1): while compilation: select _ id, from ct_t (as DISTINCT date * 1) Select normalized_date, _ id, select NULL SMS from ct_t (_ id & lt;?! And thread_id = 25 and (type = 3)) select UNION DISTINCT date * 1000 normalized_date, pdu._id, ct_t PDU from left to pdu._id = pending_msgs.msg_id Where are the pending_msgs JOIN (? _ Id & lt; and thread_id = 25 and msg_box = 3 and (msg_box = 3 and (m_type = 128 or m_type = 132 or m_type = 130))! ) Select UNION DISTINCT as the date * 1, where normalized_date, _ id, cellbroadcast (_ id The description range of order by ct_t null _ id from the & lt; and thread_id = 25) 20) the order limit is 20 by dd)  

is there any way that i just where Can only add section of SMS table?

The cursor should not be empty as if the query does not return the results, its size (cursor .getCount () Will be 0.

It is definitely true to use selection and selection - selection ==> "_id & lt;?" And selectionArgs ==> string lastThreadId [] {lastThreadId.toString ()}

The integer provided or its one if int you can use String.valueOf (lastThreadId) to wrap in a string.

In addition to this, you can use "_id"; +++++++++++++++++++++++++++++++++++++++++ ++++++++++++ "

No comments:

Post a Comment