Tuesday, April 23, 2013

[android help] Why can't I delete this contact in androidÉ


display_name is read-only.


Anyone who wants to do detailed work with the Contacts Provider should definitely read the Contacts Provider API guide and follow the Contacts Provider Android training. The Contacts provider is a complex database system with many rules, and you'll run into frustrating problems unless you understand the basic layout of the provider.


Both CommonDataKinds.StructuredName.DISPLAY_NAME and CommonDataKinds.Phone.NUMBER are set to data1, because in fact they don't refer to separate tables. Instead, they both refer to column DATA1 in ContactContracts.Data. All detailed data for contacts is stored in ContactContracts.Data, regardless of what it is. For example, all phone numbers and all email addresses for a contact are stored in ContactContracts.Data. The way you tell one type of row from another is through the row's MIMETYPE value. The documentation explains this in detail.


Another hint: you should avoid doing additions, deletions, or updates to the Contacts Provider in your own code. Instead, send an Intent that starts the device's contacts app or allows the user to choose the contacts app to use. This allows the user to do the work in the contacts app rather than your app. This is also described in the documentation.



.

stackoverflow.comm

No comments:

Post a Comment

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...