Contact Ringtone set but android.process.phone killed when that contact calls


I am trying to set a ringtone(mp3 file) stored on my /storage/sdcard0/Ringtones to a contact I wish. On running the app, the ringtone gets saved and I can see it listed when I open that contact. However, when that contact calls.

I do not get the call and the below message appears on my screen : process com.android.phone stops. Below is the code which I am using to set ringtone to a contact -

Nb: K is the File object which has the filename and path for the .mp3 clip String str1 = c.getString(c.getColumnIndexOrThrow("_id")); Uri localUri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_URI, str1); ContentValues localContentValues = new ContentValues(); localContentValues.put(ContactsContract.Data.RAW_CONTACT_ID, contactId); localContentValues.put(ContactsContract.Contacts.CUSTOM_RINGTONE, k.getAbsolutePath()); getContentResolver().update(localUri, localContentValues, null, null);

Logcat error when contact calls :

01-16 15:27:09.632: E/AndroidRuntime(24282): FATAL EXCEPTION: main 01-16 15:27:09.632: E/AndroidRuntime(24282): java.lang.NullPointerException 01-16 15:27:09.632: E/AndroidRuntime(24282): at com.android.phone.Ringer.isValidRingtoneURI(Ringer.java:742) 01-16 15:27:09.632: E/AndroidRuntime(24282): at com.android.phone.CallNotifier.onQueryComplete(CallNotifier.java:2079)


You should provide Uri rather than absolute path (see <a href="http://developer.android.com/reference/android/provider/ContactsContract.ContactOptionsColumns.html#CUSTOM_RINGTONE" rel="nofollow">here</a>):

Uri uriOfRt = Uri.fromFile(new File( k.getAbsolutePath())); localContentValues.put(ContactsContract.Contacts.CUSTOM_RINGTONE, uriOfRt);


  • How can I get rid of dynamic SQL
  • What is the SimpleDateFormat pattern that parses like the deprecated String constructor for Date?
  • Getting States and Provinces in .NET
  • Is it bad to use a malloc loop to guarantee a result from malloc?
  • GCM registration works for debug APK but not release APK
  • Linear gradient not applying in Webkit with d3 generated SVG
  • Android Login- checking if username and password match with MySQL database
  • Retrieving a contacts notes
  • Installing apk from within application in android
  • How to merge two Request in Laravel
  • How to change default stop edit behavior in jtable
  • Unique SMS sender id?
  • How to extract text from a PDF and decode characters?
  • What is this strange character in chrome's resource css viewer?
  • Time out Error in send mail
  • Application level floating views with navigation in Android
  • AndEngine Applying Transparancy to AndEngine View
  • Using a canvas object in a thread to do simple animations - Java
  • How can I sort a a table with VBA with given text condition?
  • Why querying a date BC is changed to AD in Java?
  • Disable Enter in editText android
  • Cannot resolve symbol 'MyApi'
  • Avoid links criss cross / overlap in d3.js using force layout
  • If I include Java 8 in my Android app does that affect which devices it will work on?
  • Release, debug version and Authorization Google?
  • Akka Routing: Reply's send to router ends up as dead letters
  • AT Commands to Send SMS not working in Windows 8.1
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • Load html files in TinyMce
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • Acquiring multiple attributes from .xml file in c#
  • Understanding cpu registers
  • coudnt use logback because of log4j
  • How do I configure my settings file to work with unit tests?
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • How can I remove ASP.NET Designer.cs files?
  • Is it possible to post an object from jquery to bottle.py?
  • java string with new operator and a literal
  • How do I use LINQ to get all the Items that have a particular SubItem?