title: How to search Contacts with address (FORMATTED_ADDRESS) with one query?
body: <p>I try to implement a live search over the users contacts, and I want to get the name, thumbnail and address (if there is one) of each matching contact.</p>
  
  <p>The live search is running while the user is typing. </p>
  
  <p>So he types <strong>ma</strong> and will get 'martin', 'matthews'...</p>
  
  <p>He'll continue with <strong>mat</strong> and will only see 'matthews'</p>
  
  <p>I try to achieve this with a single query like the following, but I always get the contact number in the <code>FORMATTED_ADRESS</code> field. I guess I have a <code>JOIN</code> problem, because I'm using <code>ContactsContract.CommonDataKinds</code> and <code>ContactsContract.Contacts</code> in the same query?</p>
  
  <pre><code>public static List&lt;ContactModel&gt; getContactsForQuery(Context context, String query) {
  
      String[] projection = new String[] {
          ContactsContract.Contacts.DISPLAY_NAME,
          Contacts.PHOTO_THUMBNAIL_URI,
          ContactsContract.CommonDataKinds.StructuredPostal.FORMATTED_ADDRESS
      };
  
      Uri uri = ContactsContract.CommonDataKinds.Phone.CONTENT_URI;
      String selection = ContactsContract.Contacts.DISPLAY_NAME + " LIKE '%" + query +  "%'";
      Cursor cursor = context.getContentResolver().query(uri, projection, selection, null,null);
      if (cursor.moveToFirst()) {
  
          do {
              String name = cursor.getString(0);
              String thumbail = cursor.getString(1);
              String formattedADress = cursor.getString(2);
          }
          while (cursor.moveToNext());
      }
  </code></pre>
  
  <p>I actually solved my issue, with </p>
  
  <ol>
  <li>querying for <code>Contacts._ID</code>, <code>Contacts.DISPLAY_NAME</code></li>
  <li><p>start a second query with the <code>Contacts._ID</code> like the following</p>
  
  <pre><code>Cursor detailCursor = context.getContentResolver().query(
         ContactsContract.Data.CONTENT_URI,
         new String[]{
             CommonDataKinds.StructuredPostal.STREET,
             CommonDataKinds.StructuredPostal.CITY,
             CommonDataKinds.StructuredPostal.POSTCODE
         },
         ContactsContract.Data.CONTACT_ID + "=? AND " 
             + CommonDataKinds.StructuredPostal.MIMETYPE + "=?",
         new String[]{
             String.valueOf(contactID),
             CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE
         },
         null);
  </code></pre></li>
  </ol>
  
  <p>but this will start a second query for <strong>every contact</strong>, which might not be the best approach.</p>
  
  <p>So my final question is: is it possible to get this work with the first query?</p>