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 + "%'";
Tuesday, 27 November 2012
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment