I'm new to android.I'm developing a program which in i have 3 methods:
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.
I fetch contacts info in this method:
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;
}
but i don't know which class and methods i should use to update contacts. any help really appreciate. best regards.