title: Get contacts from android device filter by account type
body: <p>I writen a application contact sync. It sync contact from server to device. When sync done with user haduy@lvsolution.vn, i want get all contact's haduy user. But it get all contact in device, don't filter by haduy user. I only want get contact of haduy@lvsolution account.</p>
  
  <pre><code>public void getContact()
  {
      String phone = null;
      String name = null;
      listContact.clear();
      ContentResolver cr = getContentResolver();
      Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI,
              null, null, null, null);
  
      if (cur.getCount() &gt; 0) {
          while (cur.moveToNext()) {
              String id = cur.getString(cur.getColumnIndex(ContactsContract.Contacts._ID));
              name = cur.getString(cur.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
              if (Integer.parseInt(cur.getString(cur.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER))) &gt; 0) {
                  System.out.println("name : " + name + ", ID : " + id);
                  // get the phone number
                  Cursor pCur = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null,
                          ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = ?",
                          new String[]{id}, null);
                  while (pCur.moveToNext()) {
                     phone = pCur.getString(
                              pCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
                      System.out.println("phone" + phone);
                  }
                  Contact contact = new Contact(name,phone);
                  listContact.add(contact);
                  pCur.close();
              }
          }
      }
  }
  </code></pre>