Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't update contact details in android using code
    primarykey
    data
    text
    <p>I'm trying to update/change contact ringtone using this code:</p> <pre><code>ContentValues values = new ContentValues(); values.put(ContactsContract.Data.CUSTOM_RINGTONE, "D:/TempDownloads/BurpSounds/Alex.wav"); getContentResolver().update(ContactsContract.Contacts.CONTENT_URI, values , "DISPLAY_NAME = 'Ani'", null); </code></pre> <p>I get the message: " the application has stopped unexpectedly"</p> <p>what is wrong with my code and how do I do it?</p> <p>thanks</p> <p>I managed to use logcat and ddms here is the log:</p> <pre><code>04-10 13:47:45.419: ERROR/AndroidRuntime(399): Caused by: java.lang.SecurityException: Permission Denial: writing com.android.providers.contacts.ContactsProvider2 uri content://com.android.contacts/contacts from pid=399, uid=10025 requires android.permission.WRITE_CONTACTS 04-10 13:47:45.419: ERROR/AndroidRuntime(399): at android.os.Parcel.readException(Parcel.java:1218) 04-10 13:47:45.419: ERROR/AndroidRuntime(399): at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:160) 04-10 13:47:45.419: ERROR/AndroidRuntime(399): at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:114) 04-10 13:47:45.419: ERROR/AndroidRuntime(399): at android.content.ContentProviderProxy.update(ContentProviderNative.java:532) 04-10 13:47:45.419: ERROR/AndroidRuntime(399): at android.content.ContentResolver.update(ContentResolver.java:737) 04-10 13:47:45.419: ERROR/AndroidRuntime(399): at com.example.helloandroid.HelloAndroid.getContactList(HelloAndroid.java:36) 04-10 13:47:45.419: ERROR/AndroidRuntime(399): at com.example.helloandroid.HelloAndroid.onCreate(HelloAndroid.java:19) 04-10 13:47:45.419: ERROR/AndroidRuntime(399): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 04-10 13:47:45.419: ERROR/AndroidRuntime(399): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459) 04-10 13:47:45.419: ERROR/AndroidRuntime(399): ... 11 more </code></pre> <p>the path I used: <code>Environment.getExternalStorageDirectory().getPath() + "/Alex.wav"</code></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload