Android People.Number and People.Number_key return null
<p>I am trying to get the contacts from the phone but all I can get is the name, the phone numbers return null.</p>

<pre><code>       Cursor cursor = getContentResolver().query(People.CONTENT_URI, null, null, null,People.NAME + " ASC");
  startManagingCursor(cursor);
  cursor.moveToFirst();
  if(cursor.getCount() &gt; 0){
  while(cursor.moveToNext()){
    int idCol = cursor.getColumnIndex(People._ID);
          int nameCol = cursor.getColumnIndex(People.NAME);
          int numCol = cursor.getColumnIndex(People.NUMBER_KEY);

          String name = cursor.getString(nameCol);
          String number = cursor.getString(numCol);
    //mDbHelper.addContact(managedCursor.getString(1),managedCursor.getString(2));
    Log.v("contact.add",name+" - "+number);
  }
</code></pre>

<p>Any ideas?</p>

<p>After about 3 hours, I have figured it out:</p>

<pre><code>   ContentResolver cr = getContentResolver();
        Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI,
                null, null, null, null);
        if (cur.getCount() &gt; 0) {
         cur.move(-1);
     while (cur.moveToNext()) {
         String id = cur.getString(
                        cur.getColumnIndex(ContactsContract.Contacts._ID));
  String name = cur.getString(
                        cur.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
   if (Integer.parseInt(cur.getString(cur.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER))) &gt; 0) {
     if (Integer.parseInt(cur.getString(
                     cur.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER))) &gt; 0) {
                  Cursor pCur = cr.query(
         ContactsContract.CommonDataKinds.Phone.CONTENT_URI, 
         null, 
         ContactsContract.CommonDataKinds.Phone.CONTACT_ID +" = ?", 
         new String[]{id}, null);
            while (pCur.moveToNext()) {

         Log.v("Phone",""+pCur.getString(pCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER))+" - "+name);
         i++;
            } 
            pCur.close();
        }

          }
            }
  }
</code></pre>
