sms - Get records with id> 60 using a ContenResolver Android -
I am developing an application that receives the message I do not really have a problem getting SMS in the app I issue is also not how to modify the data with ContenResolver , but only to select the bride whose ID is higher than the specific value, for example more than 60. Here is my code:
string [] reqCols = new string [] {"_id", "address", "body"}; ContentResolver cr = getContentResolver (); Cursor c = cr.query (Inbox URI, Recocol, Criteria & gt; 60, Blank, Blank); Thanks in advance.
Bet you can not just supply boolean. You communicate with DB through SQL queries. The query method may be a bit shorter, but you still need to supply the situation in SQL format. Try something like this:
int criterio = 60; String [] reqCols = new string [] {"_id", "address", "body"}; ContentResolver cr = getContentResolver (); Cursor c = cr.query (inbox uRI, recyclable, "_id" gt ;?, new string [] {String.valueOf (criterio)}, blank); What happens here is that a condition is provided _id & gt; ? which means that you want _id to be greater than some value that you specify later and then you in the next argument in a string array Supply the value. In this case, the value of criterio is 60 . You can only enter "_ id> 60" or "_ id" as the condition. + criterio , but it will not be very smart to always prevent the bad things like SQL injection, always supply the values in the next parameter.
Comments
Post a Comment