How to Set Ringtone with Ringtonemanager.Action_Ringtone_Picker

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



Leave a reply



Submit