I want to open the Settings-> Sound & Display-> Phone Ringtones screen from my application. How can I do that?
2 Answers
Depending on your needs, there are a couple of alternatives to bring up the 'Ringtones' settings screen from your application.
If you want to bring up the actual preferences screen that is usually available through system settings -- letting your user modify the phone's universal ringtone settings through your application -- you can use the ACTION_SOUND_SETTINGS constant from the  android.provider.Settings class to create a new Intent to start the sound settings activity.
startActivityForResult(new Intent(android.provider.Settings.ACTION_SOUND_SETTINGS), 0);
If you want to select a custom ringtone to use in your application you need to add a RingtonePreference in your preferences.xml definition file, like this:
<RingtonePreference
  android:key="alerts_ringtone"
  android:title="Select ringtone" 
  android:showDefault="true"
  android:showSilent="true"
  android:ringtoneType=""
/> 
You'll be able to get the URI to the selected preference in the application's default SharedPreferences using alerts_ringtone as the key.
The latter technique uses the PreferenceActivity class to host the preference options. I won't describe that in detail here, as the Android documentation has a good writeup and some sample code.
- 27,481
 - 8
 - 94
 - 152
 
- 96,655
 - 18
 - 100
 - 72
 
- 
                    Thanks. I want to open the Preferences screen. So will executing the Intent statement let the user set a ringtone or as soon as the user selects a ringtone it will come back to the app and the app will have to set it? – lostInTransit Mar 09 '09 at 04:15
 - 
                    1Executing the Intent statement will let the user set the ringtone -- your app won't have to do anything to handle it separately. – Reto Meier Mar 09 '09 at 09:48
 - 
                    1Note as per 2nd answer there is a mistake in first code fragment, a closing bracket is needed just after the first parameter in the Intent constructor. Would just edit but needs to be over 6 chars :) – Brizee Feb 22 '14 at 02:56
 
This is an alternate solution for the problem. I am also working in the same task but the above code does not work for me. I have changed the code to
startActivityForResult(new Intent(android.provider.Settings.ACTION_SOUND_SETTINGS), 0);
and it now works.