问题描述
我想办法在这里,但也有对自己的/选定的文件,当我打电话选取器唯一的解决办法,而不是为code。我用下面的code,当用户preSS按钮:
意向意图=新的意图(RingtoneManager.ACTION_RINGTONE_PICKER);
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE为通知选择铃声:);
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT,假);
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT,真正的);
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE,RingtoneManager.TYPE_NOTIFICATION);
ActivityCurrent.this.startActivityForResult(意向,999);
这节目铃声选择器,用户可以选择想要的铃声,但我错过两样东西: - 这doesn't显示当前的铃声,当它打开 - 它不保存铃声它被点击确定,当
我依然不容找到办法如何打开RINGTONE_PICKER与已选定当前的铃声。你知道吗?
意向意图=新的意图(RingtoneManager.ACTION_RINGTONE_PICKER);
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE为通知选择铃声:);
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT,假);
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT,真正的);
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE,RingtoneManager.TYPE_NOTIFICATION);
ActivityCurrent.this.startActivityForResult(意向,999);
您必须实施 onActivityResult()
来接收来自用户的选秀结果,然后将其保存。
如果(结果code == RESULT_OK){
开放的我们的uri = intent.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI);
如果(URI!= NULL){
串ringTonePath = uri.toString();
}
下面的例子:http://www.ceveni.com/2009/07/ringtone-picker-in-android-with-intent.html
编辑:更新
RingtoneManager.setActualDefaultRingtoneUri(
myActivity,
RingtoneManager.TYPE_RINGTONE,
URI);
您必须调用此:)
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);
You must implement onActivityResult()
to receive result from user's pick, then save it.
if (resultCode == RESULT_OK) {
Uri uri = intent.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI);
if (uri != null) {
String ringTonePath = uri.toString();
}
Here an example: http://www.ceveni.com/2009/07/ringtone-picker-in-android-with-intent.html
EDIT: update
RingtoneManager.setActualDefaultRingtoneUri(
myActivity,
RingtoneManager.TYPE_RINGTONE,
uri);
You must call this :)
这篇关于如何设置铃声与RingtoneManager.ACTION_RINGTONE_PICKER?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!