Ringtone picker - radio button set
You need to add
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, currenturi);
to set the radiobutton
How to set custom ringtone for a specific contact?
Yeah, finally I fixed it, The problem is from the input parameter of addRingtone(ringtone.getPath());
change it to addRingtone(ringtone.toString());
and it will work
How to Select ringtone from ringtonePicker dialog and show it in a textview when i press OK
This is how i did it, just replace ringtone type for type You need.
Show dialog:
private void getNotificationSound() {
Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_NOTIFICATION);
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, "Select Alert Tone");
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, (Uri) null);
this.startActivityForResult(intent, 8);
}
Get user selection:
@Override
protected void onActivityResult(final int requestCode, final int resultCode, final Intent intent) {
if (resultCode == Activity.RESULT_OK && requestCode == 8) {
Uri uri = intent.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI);
if (uri != null) {
Log.d(TAG, uri.toString());
Ringtone ringtone = RingtoneManager.getRingtone(this, uri);
String title = ringtone.getTitle(this);
tvSoundName.setText("Alert Sound: " + title);
}
}
}
Related Topics
Android Material Design Inline Datepicker Issue
Evenly Spaced Menu Items on Toolbar
Httpurlconnection.Openconnection Fails Second Time
How to Specify Location of Debug Keystore for Android Ant Debug Builds
Android Studio Could Not Find Any Version That Matches Com.Android.Support:Appcompat-V7:+
Designing Android Apps for Tablets
View Pager + Imageview +Pinch Zoom + Rotation
How Disable/Remove Android Activity Label and Label Bar
Stop Scrollview from Auto-Scrolling to an Edittext
Upload Photo Using Httppost Multipartentitybuilder
Android Build Gradle Is Too Slow (Dependency Resolution)
Set Starting Height of Collapsingtoolbarlayout
No Repository Found Error in Installing Adt in Eclipse Indigo
Draw a Semicircle in The Background of a View
How to Execute Background Task When Android App Is Closed/Set to Background