title: Android : I am trying to search for contacts on basis of their display name
body: <p>I am trying to search for contacts on basis of their display name.
  I have taken the reference from sample code given on the android developer site.</p>
  
  <p><a href="https://developer.android.com/training/contacts-provider/retrieve-names.html" rel="nofollow noreferrer">https://developer.android.com/training/contacts-provider/retrieve-names.html</a></p>
  
  <p>In this sample, search performs from the whole contacts details present in contact not only from contacts name.</p>
  
  <p>For example if a user has an email address in his contacts, then the search is performing in matching the emails as well.
   or if a number is stored in home type, then while typing h, the number present in home category also shown up.</p>
  
  <p>I want search to be limited to their display name.</p>
  
  <pre><code>     final static String SELECTION =
              (Utils.hasHoneycomb() ? Contacts.DISPLAY_NAME_PRIMARY : Contacts.DISPLAY_NAME) +
                      "&lt;&gt;''" + " AND " + Contacts.IN_VISIBLE_GROUP + "=1";
  </code></pre>
  
  <p>These is the selecton clause that i am using taken from sample code.</p>