Breaking News
Loading...
Tuesday 27 November 2012

Query Contacts database, search with selection of LIKE cause.

07:23
The previous exercise demonstrate how to "Query Contacts database" for all contacts. To search for contacts with certain constraint in DISPLAY_NAME, we can modify the selection using LIKE cause.

Change:
String selection = ContactsContract.Contacts.DISPLAY_NAME + " IS NOT NULL";

to:
String constraint = "Lau";
String selection = ContactsContract.Contacts.DISPLAY_NAME + " LIKE '%" + constraint + "%'";

Query Contacts database, search with selection of LIKE cause.


0 comments:

Post a Comment

 
Toggle Footer