0\", null, null)" />

Joke Collection Website - Public benefit messages - How to realize short message quick query in android system? (code)

How to realize short message quick query in android system? (code)

Get session list

Public static cursor query All (Context)

{

//Cursor cur = context . getcontentresolver()。 Query (content _URI, projection,

//"Length (fragment) > 0", null, null);

cursor cur = context . getcontentresolver()。 query(Uri.parse("content://sms "),

New string [] {"Thread id, date, address, read, status, type, body, count (address) is"

+ "totleCount,_id from (select thread_id,_id,substr(address,4) as address,date,read,status,type,body "

+"from sms, where the address such as \"+86%\ "and the length (thread_id)>0 jointly select thread id, _id, address, date, reading, status, type and text."

+"from SMS where length (thread _ id) > 0 and address are different \"+86% \ ") r group by R. thread _ id order by R. datedesc-"},

Empty,

Empty,

null);

Return to cur

}

Get all the contents of the session.

Public static void asyncqueryall (asyncqueryhandler handler, int tag, string thread_id)

{

handler . cancel operation(token);

ThreadID = thread _ id

Handler.startQuery(token, null, SMS _ URI _ all, PROJECTION, sql, new String[]{thread_id}, "date desc");

}