I try to find solution here, but there are only solution for own/selected file, not for code when I call picker. I use following code when user press button:
Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, "Select ringtone for notifications:");
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, false);
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true);
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE,RingtoneManager.TYPE_NOTIFICATION);
ActivityCurrent.this.startActivityForResult(intent,999);
This show ringtone picker, user can choose what ringtone wants, but I miss two things: - it doesn´t show current ringtone when it open - it not save ringtone when it is clicked on OK
I still can´t find way how to open RINGTONE_PICKER with already selected current ring tone. Any idea?
Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, "Select ringtone for notifications:");
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, false);
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true);
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE,RingtoneManager.TYPE_NOTIFICATION);
ActivityCurrent.this.startActivityForResult(intent,999);
The code is perfect and works for me. But you forgot to mention the permissions required..here it is. try this code..hope it helps
You must implement
onActivityResult()
to receive result from user's pick, then save it.Here an example: http://www.ceveni.com/2009/07/ringtone-picker-in-android-with-intent.html
EDIT: update
You must call this :)
"ringtone" is the uri in which I am saving the picked tone in
onActivityResult()
.Hope it helps you. Hit answered if it does.
This code will show default ringtone which the user sets earlier when ringtone picker is used.
Use below code in the button for ringtone intent.