How to read contacts on Android 2.0

前端 未结 9 982
我寻月下人不归
我寻月下人不归 2020-11-22 05:58

I\'m working on Android 2.0 and am trying to receive a list of all contacts.

Since android.provider.Contacts.People is deprecated, I have to use android

9条回答
  •  后悔当初
    2020-11-22 06:09

    This part wouldn't work for me:

     while (phones.moveToNext()) { 
         String phoneNumber = phones.getString( 
           phones.getColumnIndex( 
             ContactsContract.CommonDataKinds.Phone.NUMBER));                 
        } 
    

    If I use this, though, it does:

     while (phones.moveToNext()) { 
                                      String pdata = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DATA));
                                      Log.v("DATA",pdata);
    }
    

提交回复
热议问题