android 用于区分sim卡联系人和手机联系人

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/a_fly_pig/article/details/53609685


public ArrayList<PhoneNumInfo> getPhoneNumLocalList() {
ArrayList<PhoneNumInfo> typeList=new ArrayList<PhoneNumInfo>();
ContentResolver resolver = context.getContentResolver();
   Cursor cursorType = resolver.query(ContactsContract.RawContacts.CONTENT_URI, 
           new String[] {RawContacts._ID, RawContacts.ACCOUNT_NAME,RawContacts.ACCOUNT_TYPE}, 
           null, null, null); 
   if (cursorType != null) {       
       while (cursorType.moveToNext()) { 
        PhoneNumInfo pni=new PhoneNumInfo();
        pni.setPhoneID(cursorType.getInt(0));
        pni.setPhoneType(cursorType.getString(1));
        pni.setPhonePage(cursorType.getString(2));
        typeList.add(pni);
       } 
   } 
   cursorType.close(); 
   return typeList;
}

猜你喜欢

转载自blog.csdn.net/a_fly_pig/article/details/53609685