title: Search Contact By Name
body: <p>I am trying to create a <strong>Custom Contact app</strong> which displays only those <strong>contacts</strong> that have <strong>Contact Number</strong>. First of all, is there any automated way to do it? Suppose not, then I am trying to search a contact by its name e.g. <strong>Rohan</strong>.</p>
  
  <p>Here is the code :-</p>
  
  <pre><code>Cursor photoCursor = getContentResolver().query(
              android.provider.ContactsContract.Contacts.CONTENT_URI,
              new String[] { ContactsContract.Contacts.PHOTO_ID,
                      ContactsContract.Contacts.DISPLAY_NAME },
              ContactsContract.Contacts.DISPLAY_NAME + " = ?",
              new String[]{"Rohan"}, null);
      photoCursor.moveToFirst();
      while (photoCursor.moveToNext()) {
          Log.d("Photo Thumbnail", "" + photoCursor.getString(1));
      }
  </code></pre>
  
  <p>Although the contact exists, I am not getting any Log, if I remove <strong>Selection</strong> &amp; <strong>Selection Args</strong> I see <strong>Rohan</strong> in the log. What am I doing wrong?</p>