title: How to get contacts' phone number in Android
body: <p>My code is as below:</p>
  
  <pre><code>String[] columns = {ContactsContract.Contacts._ID, ContactsContract.Contacts.DISPLAY_NAME, ContactsContract.Contacts.HAS_PHONE_NUMBER};
  Cursor cursor = getContentResolver().query(ContactsContract.Contacts.CONTENT_URI, columns, null, null, null);
  
  int ColumeIndex_ID = cursor.getColumnIndex(ContactsContract.Contacts._ID);
  int ColumeIndex_DISPLAY_NAME = cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME);
  int ColumeIndex_HAS_PHONE_NUMBER = cursor.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER);
  
  while(cursor.moveToNext()) 
  {   
      String id = cursor.getString(ColumeIndex_ID);
      String name = cursor.getString(ColumeIndex_DISPLAY_NAME);
      String has_phone = cursor.getString(ColumeIndex_HAS_PHONE_NUMBER);
  
      if(!has_phone.endsWith("0")) 
      {
          System.out.println(name);
          GetPhoneNumber(id);
      }           
  }
  
  cursor.close();
  
  
  public String GetPhoneNumber(String id) 
  {
      String number = "";
      Cursor phones = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, ContactsContract.CommonDataKinds.Phone._ID + " = " + id, null, null);
  
      if(phones.getCount() &gt; 0) 
      {
          while(phones.moveToNext()) 
          {
              number = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
          }
          System.out.println(number);
      }
  
      phones.close();
  
      return number;
  }
  </code></pre>
  
  <p>I get contacts' name success, but get phone number fail in <code>GetPhoneNumber()</code>.<br>
  The <code>phones.getCount()</code> always equal 0.<br>
  How can I modify?  </p>