Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/202.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在android中更新联系人信息?_Android - Fatal编程技术网

如何在android中更新联系人信息?

如何在android中更新联系人信息?,android,Android,我是android的新手,我正在开发一个程序,在我的程序中有3种方法: 1-FetchContactInformation() : read contacts id , name, number 2-ChangeContactsInfo():change names and numbers 3-UpdateContacts(): it shoulde read the list from second method and update each contact one b

我是android的新手,我正在开发一个程序,在我的程序中有3种方法:

 1-FetchContactInformation() : read contacts id , name, number 
 2-ChangeContactsInfo():change names and numbers
 3-UpdateContacts(): it shoulde read the list from second method and update each        contact one by one.
我使用此方法获取联系人信息:

   private ArrayList<ContactInfo> FetchContactInfo() {
    int i = 0;
    ArrayList<ContactInfo> contactList = new ArrayList<ContactInfo>();
    Cursor readingContactsCursor = getContentResolver().query(
            ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
            new String[] { Phone._ID, Phone.DISPLAY_NAME, Phone.NUMBER },
            null, null, Phone.DISPLAY_NAME + " ASC");

    contactList.clear();
    readingContactsCursor.moveToFirst();

    while (i < 3) {
        ContactInfo contactInfo = new ContactInfo();
        contactInfo.setContactID(readingContactsCursor.getString(0)
                .toString());
        contactInfo.setContactName(readingContactsCursor.getString(1)
                .toString());
        contactInfo.setContactNumber(readingContactsCursor.getString(2)
                .toString());
        readingContactsCursor.moveToNext();
        contactList.add(contactInfo);


        i++;
    }
    readingContactsCursor.close();

    return contactList;
}
private ArrayList FetchContactInfo(){
int i=0;
ArrayList contactList=新建ArrayList();
游标读取ContactSCURSOR=getContentResolver().query(
ContactsContract.CommonDataTypes.Phone.CONTENT\u URI,
新字符串[]{Phone.\u ID,Phone.DISPLAY\u NAME,Phone.NUMBER},
空,空,Phone.DISPLAY_NAME+“ASC”);
contactList.clear();
读取ContactsCorsors.moveToFirst();
而(i<3){
ContactInfo ContactInfo=新的ContactInfo();
contactInfo.setContactID(读取ContactSCURSOR.getString(0)
.toString());
contactInfo.setContactName(读取ContactSCURSOR.getString(1)
.toString());
contactInfo.setContactNumber(读取ContactsCorsors.getString(2)
.toString());
正在读取ContactsCorsor.moveToNext();
联系人列表。添加(联系人信息);
i++;
}
读取ContactsCorsor.close();
返回联系人列表;
}
但我不知道应该使用哪个类和方法来更新联系人。 任何帮助都非常感谢。 致以最诚挚的问候。

请点击此处或查看联系人信息,如果您需要更多详细信息,请查看