The previous exercise demonstrate how to "Query Contacts database" for all contacts, "Search for contacts with phone number only" and "Search with selection of LIKE cause". To combine both cause to search for contacts has phone number with certain constraint in DISPLAY_NAME, combine both cause with "AND".
Change:
String selection = ContactsContract.Contacts.DISPLAY_NAME + " IS NOT NULL";
to:
String constraint = "Lau";
String selection =
ContactsContract.Contacts.HAS_PHONE_NUMBER + "=1"
+ " AND "
+ ContactsContract.Contacts.DISPLAY_NAME + " LIKE '%" + constraint + "%'";
Home »
» Query Contacts database, selection with AND to combine more cause.
Query Contacts database, selection with AND to combine more cause.
Written By MR HARI on Rabu, 28 November 2012 | 06.32
Related Articles
If you enjoyed this article just click here, or subscribe to receive more great content just like it.

0 komentar:
Posting Komentar