【问题标题】:Read all contacts' phone numbers in android在android中读取所有联系人的电话号码
【发布时间】:2025-12-22 09:55:07
【问题描述】:

我正在使用此代码检索所有联系人姓名和电话号码:

String[] projection = new String[]
{
    People.NAME,
    People.NUMBER
};

Cursor c = ctx.getContentResolver().query(People.CONTENT_URI, projection, null, null, People.NAME + " ASC");
c.moveToFirst();

int nameCol = c.getColumnIndex(People.NAME);
int numCol = c.getColumnIndex(People.NUMBER);

int nContacts = c.getCount();

do
{
  // Do something
} while(c.moveToNext());

但是,这只会返回每个联系人的主要号码,但我也想获取辅助号码。我该怎么做?

【问题讨论】:

标签: android contacts android-contacts phone-number


【解决方案1】:

以下代码显示了一种读取所有电话号码和姓名的简单方法:

Cursor phones = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null,null,null, null);
while (phones.moveToNext())
{
  String name=phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME));
  String phoneNumber = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));

}
phones.close();

注意: getContentResolver 是来自 Activity 上下文的方法。

【讨论】:

  • 谢谢,这个单查询方式快100倍!
  • 明显更快,但如果联系人的号码超过 1 个,则联系人姓名可能会重复。
  • @Dinesh Kumar 检索所有联系人,但我需要用户选择的单个联系人
  • 这里如何避免重复?
  • 它只得到一些小接触!就我而言,ContactsContract.CommonDataKinds.Phone.CONTENT_URI 给我 361 联系人,但ContactsContract.Contacts.CONTENT_URI 给我 5115 联系人!有什么区别?!
【解决方案2】:

您可以通过以下方式读取与联系人关联的所有电话号码:

Uri personUri = ContentUris.withAppendedId(People.CONTENT_URI, personId);
Uri phonesUri = Uri.withAppendedPath(personUri, People.Phones.CONTENT_DIRECTORY);
String[] proj = new String[] {Phones._ID, Phones.TYPE, Phones.NUMBER, Phones.LABEL}
Cursor cursor = contentResolver.query(phonesUri, proj, null, null, null);

请注意,此示例(与您的示例一样)使用已弃用的联系人 API。从 eclair 开始,这已被 ContactsContract API 取代。

【讨论】:

    【解决方案3】:

    此代码显示如何获取每个联系人的所有电话号码。

    ContentResolver cr = getActivity().getContentResolver();
    Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);
    if (cur.getCount() > 0) {
        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))) > 0) {
                 Cursor pCur = cr.query(
                          ContactsContract.CommonDataKinds.Phone.CONTENT_URI, 
                          null, 
                          ContactsContract.CommonDataKinds.Phone.CONTACT_ID +" = ?", 
                          new String[]{id}, null);
                 while (pCur.moveToNext()) {
                      int phoneType = pCur.getInt(pCur.getColumnIndex(
                          ContactsContract.CommonDataKinds.Phone.TYPE));
                      String phoneNumber = pCur.getString(pCur.getColumnIndex(
                          ContactsContract.CommonDataKinds.Phone.NUMBER));
                      switch (phoneType) {
                            case Phone.TYPE_MOBILE:
                                Log.e(name + "(mobile number)", phoneNumber);
                                break;
                            case Phone.TYPE_HOME:
                                Log.e(name + "(home number)", phoneNumber);
                                break;
                            case Phone.TYPE_WORK:
                                Log.e(name + "(work number)", phoneNumber);
                                break;
                            case Phone.TYPE_OTHER:
                                Log.e(name + "(other number)", phoneNumber);
                                break;                                  
                            default:
                                break;
                      }
                  } 
                  pCur.close();
            }
        }
    }
    

    【讨论】:

    • 嗨@anivaler。我试图在我的代码中实现您的解决方案,但效果不佳。显示正确的数字,但是当我滚动更改数字时。你能看看我的问题吗? *.com/questions/38978923/…
    • 嗨,我已经实现了它工作正常,但我没有明白它有什么问题,它显示带有姓名的电话号码超过 2 次,但是当我在电话中检查它时,相同的号码和姓名是只来一次
    【解决方案4】:

    如果有帮助,我有一个示例,它使用 ContactsContract API 首先按姓名查找联系人,然后遍历详细信息以查找特定号码类型:

    How to use ContactsContract to retrieve phone numbers and email addresses

    【讨论】:

      【解决方案5】:
      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))) > 0) 
      {
          System.out.println("name : " + name + ", ID : " + id);
      
          // get the <span id="IL_AD4" class="IL_AD">phone
          // number</span>
          Cursor pCur = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, 
                                 null, 
                                 ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = ?", new String[] { id }, null);
      
          while (pCur.moveToNext())
          {
              String phone = pCur.getString(pCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
              System.out.println("phone" + phone);
          }
      
      pCur.close();
      

      【讨论】:

        【解决方案6】:

        您可以使用此获取所有电话联系人:

            Cursor c = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
                    new String[] { ContactsContract.Contacts._ID,
                            ContactsContract.Contacts.DISPLAY_NAME,
                            ContactsContract.CommonDataKinds.Phone.NUMBER,
                            ContactsContract.RawContacts.ACCOUNT_TYPE },
                    ContactsContract.RawContacts.ACCOUNT_TYPE + " <> 'google' ",
                    null, null);
        

        查看完整示例HERE............

        【讨论】:

        • 对于我的 ~ 800 个联系人,此答案中的代码运行 89 毫秒,但另一种方式(查询联系人 ID,然后查询每个 ID 的电话号码)使用 23 000 毫秒!
        • 超级快!最佳答案
        【解决方案7】:

        你可以从这段代码中得到所有没有号码和没有名字的联系人

        public void readContacts() {
            ContentResolver cr = getContentResolver();
            Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI,
                    null, null, null, ContactsContract.RawContacts.DISPLAY_NAME_PRIMARY + " ASC");
            ContactCount = cur.getCount();
        
            if (cur.getCount() > 0) {
                while (cur.moveToNext()) {
                    String id = cur.getString(cur.getColumnIndex(ContactsContract.Contacts._ID));
                    String name = cur.getString(cur.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
                    String phone = null;
                    if (Integer.parseInt(cur.getString(cur.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER))) > 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);
                        }
                        pCur.close();
                    }
                    if (phone == "" || name == "" || name.equals(phone)) {
                        if (phone.equals(""))
                            getAllContact.add(new MissingPhoneModelClass("No Number", name, id));
                        if (name.equals("") || name.equals(phone))
                            getAllContact.add(new MissingPhoneModelClass(phone, "No Name", id));
        
                    } else {
                        if(TextUtils.equals(phone,null)){
                            getAllContact.add(new MissingPhoneModelClass("No Number", name, id));
                        }
                        else {
                            getAllContact.add(new MissingPhoneModelClass(phone, name, id));
                        }
                    }
                }
            }
        }
        

        可以做一件事,您必须在清单中授予联系人 READ 和 WRITE 权限 之后,您可以为列表创建模型类,可用于添加所有联系人这里是模型类

        public class PhoneModelClass {
        private String number;
        private String name;
        private String id;
        private String rawId;
        
        public PhoneModelClass(String number, String name, String id, String rawId) {
            this.number = number;
            this.name = name;
            this.id = id;
            this.rawId = rawId;
        }
        
        public PhoneModelClass(String number, String name, String id) {
            this.number = number;
            this.name = name;
            this.id = id;
        }
        
        public String getRawId() {
            return rawId;
        }
        
        public void setRawId(String rawId) {
            this.rawId = rawId;
        }
        
        public String getNumber() {
            return number;
        }
        
        public void setNumber(String number) {
            this.number = number;
        }
        
        public String getName() {
            return name;
        }
        
        public void setName(String name) {
            this.name = name;
        }
        
        public String getId() {
            return id;
        }
        
        public void setId(String id) {
            this.id = id;
          }
        }
        

        享受:)

        【讨论】:

        • 注意:这段代码很慢,因为它为每个联系人创建一个新查询
        • 它用于单个联系人中的多个电话号码,这就是为什么它会检查联系人是否有多个号码相应地使用它
        【解决方案8】:

        以同样的方式,使用其他“人物”引用获取他们的其他号码

        People.TYPE_HOME
        People.TYPE_MOBILE
        People.TYPE_OTHER
        People.TYPE_WORK
        

        【讨论】:

          【解决方案9】:

          接受的答案有效,但没有给出唯一的数字。

          查看此代码,它返回唯一的数字。

          public static void readContacts(Context context) {
                  if (context == null)
                      return;
                  ContentResolver contentResolver = context.getContentResolver();
          
                  if (contentResolver == null)
                      return;
          
                  String[] fieldListProjection = {
                          ContactsContract.CommonDataKinds.Phone.CONTACT_ID,
                          ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME,
                          ContactsContract.CommonDataKinds.Phone.NUMBER,
                          ContactsContract.CommonDataKinds.Phone.NORMALIZED_NUMBER,
                          ContactsContract.Contacts.HAS_PHONE_NUMBER
                  };
          
                  Cursor phones = contentResolver
                          .query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI
                                  , fieldListProjection, null, null, null);
                  HashSet<String> normalizedNumbersAlreadyFound = new HashSet<>();
          
                  if (phones != null && phones.getCount() > 0) {
                      while (phones.moveToNext()) {
                          String normalizedNumber = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NORMALIZED_NUMBER));
                          if (Integer.parseInt(phones.getString(phones.getColumnIndex(
                                  ContactsContract.Contacts.HAS_PHONE_NUMBER))) > 0) {
                              if (normalizedNumbersAlreadyFound.add(normalizedNumber)) {
                                  String id = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.CONTACT_ID));
                                  String name = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME));
                                  String phoneNumber = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
                                  Log.d("test", " Print all values");
                              }
                          }
                      }
                      phones.close();
                  }
              }
          

          【讨论】:

            【解决方案10】:

            这个one终于给了我想要的答案。它可以让您检索手机上联系人的所有姓名和电话号码。

            package com.test;
            
            import android.app.Activity;
            import android.content.ContentResolver;
            import android.database.Cursor;
            import android.os.Bundle;
            import android.provider.ContactsContract;
            
            public class TestContacts extends Activity {
                /** Called when the activity is first created. */
                @Override
                public void onCreate(Bundle savedInstanceState) {
                    super.onCreate(savedInstanceState);
                    setContentView(R.layout.main);
                    ContentResolver cr = getContentResolver();
                    Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI,
                                          null, null, null, null);
                    if (cur != null && cur.getCount() > 0) {
                        while (cur.moveToNext()) {
            
                            if (Integer.parseInt.equals(cur.getString(cur.getColumnIndex(
                                        ContactsContract.Contacts.HAS_PHONE_NUMBER)))) {
                                String id = cur.getString(cur.getColumnIndex(
                                            ContactsContract.Contacts._ID));
                                String name = cur.getString(cur.getColumnIndex(
                                            ContactsContract.Contacts.DISPLAY_NAME));
                                Cursor pCur = cr.query(
                                                       ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
                                        null,
                                        ContactsContract.CommonDataKinds.Phone.CONTACT_ID
                                                + " = ?", new String[] { id }, null);
                                int i = 0;
                                int pCount = pCur.getCount();
                                String[] phoneNum = new String[pCount];
                                String[] phoneType = new String[pCount];
                                while (pCur != null && pCur.moveToNext()) {
                                    phoneNum[i] = pCur.getString(pCur.getColumnIndex(
                                    ContactsContract.CommonDataKinds.Phone.NUMBER));
                                    phoneType[i] = pCur.getString(pCur.getColumnIndex(
                                            ContactsContract.CommonDataKinds.Phone.TYPE));
                                    i++;
                                }
                            }
            
                        }
            
                    }
            
                }
            }
            

            【讨论】:

            • 确实不应该允许在没有解释的情况下投反对票,但我已经将我的代码更新为现在的样子。我目前使用此代码。如果有错别字或导致其无法正常工作的原因,请告诉我,我会修复它。
            【解决方案11】:

            我解决了我的需要,亲爱的

            清单权限

                    <uses-permission android:name="android.permission.READ_CONTACTS" />
                    <uses-permission android:name="android.permission.WRITE_CONTACTS"/>
                    <!-- Read Contacts from phone -->
                    <uses-permission android:name="android.permission.read_contacts" />
                    <uses-permission android:name="android.permission.read_phone_state" />
                    <uses-permission android:name="android.permission.READ_CALL_LOG" />
            

            注意:在清单中授予权限后,某些手机可能会拒绝,如果需要,您需要转到设置->应用程序->找到您的应用程序点击它并 打开所需的权限

             btn_readallcontacks.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        Cursor phones = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, null, null, null);
                        List<User> userList = new ArrayList<User>();
                        while (phones.moveToNext()) {
                            User user = new User();
                            user.setNamee(phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME)));
                            user.setPhone(phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)));
                            userList.add(user);
                            Log.d(TAG, "Name : " + user.getNamee().toString());
                            Log.d(TAG, "Phone : " + user.getPhone().toString());
                        }
                        phones.close();
                    }
                });
            

            【讨论】:

              【解决方案12】:

              使用 CursorLoader 在后台加载联系人:

                CursorLoader cursor = new CursorLoader(this, ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, null, null, null);
                          Cursor managedCursor = cursor.loadInBackground();
              
                          int number = managedCursor.getColumnIndex(ContactsContract.Contacts.Data.DATA1);
                          int name = managedCursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME);
                          int index = 0;
                          while (managedCursor.moveToNext()) {
                              String phNumber = managedCursor.getString(number);
                              String phName = managedCursor.getString(name);
                          }
              

              【讨论】:

                【解决方案13】:

                以下是使用ContentsContract API 获取电话簿中联系人的方法。 您需要将这些权限添加到您的 AndroidManifest.xml

                <uses-permission android:name="android.permission.WRITE_CONTACTS" />
                <uses-permission android:name="android.permission.READ_CONTACTS" />
                

                然后,您可以运行此方法来遍历所有联系人。

                这是一个查询姓名和电话号码等字段的示例,您可以将自己配置为使用 CommonDataKinds,它会查询您联系人中的其他字段。

                https://developer.android.com/reference/android/provider/ContactsContract.CommonDataKinds

                private fun readContactsOnDevice() {
                    val context = requireContext()
                    if (ContextCompat.checkSelfPermission(
                            context, Manifest.permission.WRITE_CONTACTS
                        ) != PackageManager.PERMISSION_GRANTED &&
                        ContextCompat.checkSelfPermission(
                            context, Manifest.permission.READ_CONTACTS
                        ) != PackageManager.PERMISSION_GRANTED
                    ) {
                        requestPermissions(
                            arrayOf(Manifest.permission.READ_CONTACTS, Manifest.permission.WRITE_CONTACTS), 1
                        )
                        return
                    }
                
                    val contentResolver = context.contentResolver
                    val contacts = contentResolver.query(
                        ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
                        null, null, null, null
                    )
                
                    while (contacts?.moveToNext() == true) {
                        val name = contacts.getString(
                            contacts.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME)
                        )
                        val phoneNumber = contacts.getString(
                            contacts.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)
                        )
                        Timber.i("Name: $name, Phone Number: $phoneNumber")
                    }
                }
                

                【讨论】:

                  【解决方案14】:
                       package com.example.readcontacts;
                  
                          import java.util.ArrayList;
                  
                          import android.app.Activity; import android.app.ProgressDialog;
                          import android.content.ContentResolver; import
                          android.database.Cursor; import android.net.Uri; import
                          android.os.Bundle; import android.os.Handler; import
                          android.provider.ContactsContract; import android.view.View; import
                          android.widget.AdapterView; import
                          android.widget.AdapterView.OnItemClickListener; import
                          android.widget.ArrayAdapter; import android.widget.ListView; import
                          android.widget.Toast;
                  
                          public class MainActivity extends Activity {    private ListView
                          mListView;  private ProgressDialog pDialog;     private Handler
                          updateBarHandler;
                  
                              ArrayList<String> contactList;  Cursor cursor;  int counter;    
                              @Override   public void onCreate(Bundle savedInstanceState) {
                                  super.onCreate(savedInstanceState);
                                  setContentView(R.layout.activity_main);
                  
                                  pDialog = new ProgressDialog(this);         pDialog.setMessage("Reading
                          contacts...");      pDialog.setCancelable(false);       pDialog.show();
                  
                                  mListView = (ListView) findViewById(R.id.list);         updateBarHandler
                          =new Handler();
                                          // Since reading contacts takes more time, let's run it on a separate thread.       new Thread(new Runnable() {
                  
                                      @Override           public void run() {
                                          getContacts();          }       }).start();
                  
                                  // Set onclicklistener to the list item.
                                  mListView.setOnItemClickListener(new OnItemClickListener() {
                  
                                      @Override           public void onItemClick(AdapterView<?> parent, View
                          view,
                                              int position, long id) {
                                          //TODO Do whatever you want with the list data
                                          Toast.makeText(getApplicationContext(), "item clicked : \n"+contactList.get(position), Toast.LENGTH_SHORT).show();          }
                                  });     }
                  
                              public void getContacts() {
                  
                  
                                  contactList = new ArrayList<String>();
                  
                                  String phoneNumber = null;      String email = null;
                  
                                  Uri CONTENT_URI = ContactsContract.Contacts.CONTENT_URI;        String
                          _ID = ContactsContract.Contacts._ID;        String DISPLAY_NAME = ContactsContract.Contacts.DISPLAY_NAME;       String HAS_PHONE_NUMBER =
                          ContactsContract.Contacts.HAS_PHONE_NUMBER;
                  
                                  Uri PhoneCONTENT_URI =
                          ContactsContract.CommonDataKinds.Phone.CONTENT_URI;         String
                          Phone_CONTACT_ID =
                          ContactsContract.CommonDataKinds.Phone.CONTACT_ID;      String NUMBER =
                          ContactsContract.CommonDataKinds.Phone.NUMBER;
                  
                                  Uri EmailCONTENT_URI = 
                          ContactsContract.CommonDataKinds.Email.CONTENT_URI;         String
                          EmailCONTACT_ID = ContactsContract.CommonDataKinds.Email.CONTACT_ID;
                                  String DATA = ContactsContract.CommonDataKinds.Email.DATA;
                  
                                  StringBuffer output;
                  
                                  ContentResolver contentResolver = getContentResolver();
                  
                                  cursor = contentResolver.query(CONTENT_URI, null,null, null,
                          null);  
                  
                                  // Iterate every contact in the phone       if (cursor.getCount() > 0)
                          {
                  
                                      counter = 0;            while (cursor.moveToNext()) {
                                          output = new StringBuffer();
                  
                                          // Update the progress message
                                          updateBarHandler.post(new Runnable() {
                                              public void run() {
                                                  pDialog.setMessage("Reading contacts : "+ counter++ +"/"+cursor.getCount());
                                              }
                                          });
                  
                                          String contact_id = cursor.getString(cursor.getColumnIndex( _ID ));
                                          String name = cursor.getString(cursor.getColumnIndex( DISPLAY_NAME ));
                  
                                          int hasPhoneNumber = Integer.parseInt(cursor.getString(cursor.getColumnIndex(
                          HAS_PHONE_NUMBER )));
                  
                                          if (hasPhoneNumber > 0) {
                  
                                              output.append("\n First Name:" + name);
                  
                                              //This is to read multiple phone numbers associated with the same contact
                                              Cursor phoneCursor = contentResolver.query(PhoneCONTENT_URI, null, Phone_CONTACT_ID + " = ?", new String[] { contact_id }, null);
                  
                                              while (phoneCursor.moveToNext()) {
                                                  phoneNumber = phoneCursor.getString(phoneCursor.getColumnIndex(NUMBER));
                                                  output.append("\n Phone number:" + phoneNumber);
                  
                                              }
                  
                                              phoneCursor.close();
                  
                                              // Read every email id associated with the contact
                                              Cursor emailCursor = contentResolver.query(EmailCONTENT_URI,    null, EmailCONTACT_ID+ " =
                          ?", new String[] { contact_id }, null);
                  
                                              while (emailCursor.moveToNext()) {
                  
                                                  email = emailCursor.getString(emailCursor.getColumnIndex(DATA));
                  
                                                  output.append("\n Email:" + email);
                  
                                              }
                  
                                              emailCursor.close();
                                          }
                  
                                          // Add the contact to the ArrayList
                                          contactList.add(output.toString());             }
                  
                                      // ListView has to be updated using a ui thread
                                      runOnUiThread(new Runnable() {
                  
                                          @Override
                                          public void run() {
                                              ArrayAdapter<String> adapter = new ArrayAdapter<String>(getApplicationContext(), R.layout.list_item,
                          R.id.text1, contactList);
                                              mListView.setAdapter(adapter);          
                                          }           });
                  
                                      // Dismiss the progressbar after 500 millisecondds
                                      updateBarHandler.postDelayed(new Runnable() {
                  
                                          @Override
                                          public void run() {
                                              pDialog.cancel();               
                                          }           }, 500);        }
                  
                              }
                  
                          }
                  
                  List item
                  

                  【讨论】:

                    【解决方案15】:

                    获取联系人姓名(升序)和号码的代码

                    更多参考:show contact in listview

                    Cursor phones = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null,null,null, ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME+" ASC");
                            while (phones.moveToNext())
                            {
                                String name=phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME));
                                String phoneNumber = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
                    
                    
                            }
                            phones.close();
                    

                    【讨论】:

                      最近更新 更多