Sunday, September 9, 2012

How to use SQL LIKE with content uri?

Today, I wanted to look something up from the Android calendar using URI. Its simple

String where = "title LIKE '%"+ searchText +"%'";

String[] projection = new String[] { "_id", "title", "description", "dtstart", "eventLocation" };
Cursor cursor = context.getContentResolver().query(
Uri.parse(getCalendarUriBase()), projection, where, null, null);

Don't use Selection and SelectionArgs. It does not work

No comments:

Post a Comment