dotMobimobiThinkingmobiForgemobiReadyDeviceAtlasgoMobi

Posted by khanhtungna 1 year 46 weeks ago

pic
 khanhtungna
mobiForge Newbie
Posts: 2
Joined: 1 year ago
[offline]

Hi Everyone!
I have trouble when using GLOB to search SMS Inbox content in Android. I don't know why my query is wrong. Thank you for any suggestion.
The Logcat show the Exception as bellow:

03-20 16:22:31.635: ERROR/AndroidRuntime(438): android.database.sqlite.SQLiteException: near "*": syntax error: , while compiling: SELECT _id, address, date, body, person FROM sms WHERE (type=1) AND (body GLOB *good*) ORDER BY date DESC

And here is my code:

String uriStrInbox = "content://sms/inbox";
Uri SMS_CONTENT_URI = Uri.parse(uriStrInbox);
final String sortOrder = "date DESC";
final String[] projection = new String[] { "_id", "address", "date", "body", "person" };
String contentGlob = "body GLOB *"+searchStr+"*";
Cursor cursor = context.getContentResolver().query(SMS_CONTENT_URI, projection, contentGlob, null, sortOrder);