Query Contacts database, search with selection of LIKE cause.

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.


thumbnail
Title: Query Contacts database, search with selection of LIKE cause.
Rating: 100% based on 99998 ratings. 10 user reviews.
Post by

Related articles :

0 comments:

Post a Comment

My Blog List

 
Copyright © 2015. About - Web Version - Mobile Version Sitemap - Contact - Privacy