title: Fast reading contacts android
body: <p>Is there a faster method for reading contacts in android? For example my method with cursor take 3-5 seconds for reading 30-50 contacts. It's very long.</p>
  
  <pre><code>        Cursor cursor =  managedQuery(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);      
             while (cursor.moveToNext()) 
             {           
                 String contactId = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts._ID));
  
                 String hasPhone = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER));
  
                 if ( hasPhone.equalsIgnoreCase("1"))
                     hasPhone = "true";
                 else
                     hasPhone = "false" ;
  
                 if (Boolean.parseBoolean(hasPhone)) 
                 {
                  Cursor phones = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null,ContactsContract.CommonDataKinds.Phone.CONTACT_ID +" = "+ contactId,null, null);
                  while (phones.moveToNext()) 
                  {
                    names.add(cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.Contacts.DISPLAY_NAME))); 
                    numbers.add(phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)));
                  }
                  phones.close();
                 }
            }     
  </code></pre>
  
  <p>Any ideas?</p>