Hi,
I am trying to update information in Contacts database, phonenumber.
Analyzing following code:
public ArrayList<Phone> getPhoneNumbers(String id) {
ArrayList<Phone> phones = new ArrayList<Phone>();
Cursor pCur = this.cr.query(
ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
null,
ContactsContract.CommonDataKinds.Phone.CONTACT_ID +" = ?",
new String[]{id}, null);
while (pCur.moveToNext()) {
phones.add(new Phone(
pCur.getString(pCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER))
,
pCur.getString(pCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.TYPE))
));
}
pCur.close();
return(phones);
}
I am trying to update info about record with id=1:
Doc says that I could use getContentResolver.update();
So I want to use it like
ContentResolver cr = getContentResolver();
final ContentValues values = new ContentValues();
values.put(ContactsContract.CommonDataKinds.Phone.NUMBER, "55555555");
cr.update(ContactsContract.Contacts.CONTENT_URI, values, where,
selectionArgs);
Will this work and how to configure where and selectionArgs properly
for doing this if it works?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en