Search code examples
androidandroid-alertdialogandroid-alarmsringtone

Android Ringtone picker list with default option selected


I am trying to display a window picker dialog in android with the default selection to be instead of "None" how it is currently, to be selected the default phone's alarm/ringtone.

Here is the code I tried:

Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
            intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE,
                    RingtoneManager.TYPE_NOTIFICATION
                            | RingtoneManager.TYPE_RINGTONE);
            intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true);
            intent.putExtra(RingtoneManager.EXTRA_RINGTONE_DEFAULT_URI,
                    RingtoneManager
                            .getDefaultUri(RingtoneManager.TYPE_NOTIFICATION));
            startActivityForResult(intent, 0);

See the screenshot for details.enter image description here


Solution

  • Have you tried this ? Ringtone picker - radio button set