Reputation: 896
I want to set a query to get names which cointain the a particular string (here constraint). SO I coded:
Cursor contactCursor = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, new String[]{Phone.DISPLAY_NAME}, Phone.DISPLAY_NAME + "like + ?", new String[]{"%"+constraint+"%"}, Phone.DISPLAY_NAME + " ASC");
But I get en error. I know that I'm close. Where I'm wrong?
Upvotes: 0
Views: 278
Reputation: 86948
You have a simple typo. Change this:
"like + ?"
to this:
" like ?"
(add a space in the front and remove the +
).
Upvotes: 1