[android-developers] Unable to Update a Contact Phone number
Hi All, I am currently unable to update an existing contact record's phone number. I am able to insert a new phone number to an existing contact record but unable to delete or modify existing phone number records of a contact. Is there a way to either: - delete an existing phone number from a contact record. or - update an existing phone number of a contact record. The sample code is as shown below: To delete existing phone numbers of a contact record: row = getContentResolver().delete(ContentUris.withAppendedId (Phones.CONTENT_URI, uid),null,null); Log.v(TAG,"row =" + row); the row value is always 0 even if phone numbers are present. Thus, the deletion does not take place. To update a phone number: Uri PersonUri = ContentUris.withAppendedId(People.CONTENT_URI, uid); Uri PhoneUri = Uri.withAppendedPath (PersonUri,People.Phones.CONTENT_DIRECTORY); ContentValues values = new ContentValues(); values.put(Phones.NUMBER,"1234567890"); values.put(Phones.TYPE,1); row = getContentResolver().update(PhoneUri,values, null, null); This throws a unsupported Operation exception. Kindly guide. Thanks and Regards, Sam --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Unable to Update a Contact Phone number
Hi All, I am currently unable to update an existing contact record's phone number. I am able to insert a new phone number to an existing contact record but unable to delete or modify existing phone number records of a contact. Is there a way to either: - delete an existing phone number from a contact record. or - update an existing phone number of a contact record. The sample code is as shown below: To delete existing phone numbers of a contact record: row = getContentResolver().delete(ContentUris.withAppendedId (Phones.CONTENT_URI, uid),null,null); Log.v(TAG,"row =" + row); the row value is always 0 even if phone numbers are present. Thus, the deletion does not take place. To update a phone number: Uri PersonUri = ContentUris.withAppendedId(People.CONTENT_URI, uid); Uri PhoneUri = Uri.withAppendedPath (PersonUri,People.Phones.CONTENT_DIRECTORY); ContentValues values = new ContentValues(); values.put(Phones.NUMBER,"1234567890"); values.put(Phones.TYPE,1); row = getContentResolver().update(PhoneUri,values, null, null); This throws a unsupported Operation exception. Kindly guide. Thanks and Regards, Sam --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---