对于sim卡联系人,android电话号码为空

对于sim卡联系人,android电话号码为空,android,Android,以下代码将SIM卡中联系人的电话号码返回为空。而对于手机中的联系人,它会返回正确的值。请让我知道,从SIM卡读取电话号码时URI是否应该不同。下面是我的代码,几乎是Android联系人教程的副本 long contactId = -1; // Load the display name for the specified person Cursor cursor = contentResol

以下代码将SIM卡中联系人的电话号码返回为空。而对于手机中的联系人,它会返回正确的值。请让我知道,从SIM卡读取电话号码时URI是否应该不同。下面是我的代码,几乎是Android联系人教程的副本

                            long contactId = -1;

            // Load the display name for the specified person
            Cursor cursor = contentResolver.query(contactUri,new String[]{Contacts._ID, Contacts.DISPLAY_NAME}, null, null, null);
            try 
            {
                if (cursor.moveToFirst()) 
                {
                    contactId = cursor.getLong(0);
                }
            }
            finally
            {
                cursor.close();
            }

            // Load the phone number (if any).
            String phoneNumber=null;
            cursor = contentResolver.query(Phone.CONTENT_URI,new String[]{Phone.NUMBER},Phone.CONTACT_ID + "=" + contactId, null, Phone.IS_SUPER_PRIMARY + " DESC");
            try 
            {
                if (cursor.moveToFirst()) 
                {
                    phoneNumber=cursor.getString(0);

                }
            } 
            finally 
            {
                cursor.close();
            }

检查此项:@LAS_VEGAS,但该链接过程使用不推荐的API!!这个怎么样:@LAS_VEGAS。。非常感谢。我试试看。