转到设置屏幕 [英] Go to settings screen

查看:77
本文介绍了转到设置屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要打开设置->声音和声音。我的应用程序中的显示->手机铃声屏幕。我该怎么办?

I want to open the Settings-> Sound & Display-> Phone Ringtones screen from my application. How can I do that?

推荐答案

根据您的需要,有两种方法可以调出铃声设置

Depending on your needs, there are a couple of alternatives to bring up the 'Ringtones' settings screen from your application.

如果您想调出通常可通过系统设置获得的实际首选项屏幕,则可让您的用户通过您的手机修改手机的通用铃声设置应用程序-您可以使用 android.provider.Settings 类中的 ACTION_SOUND_SETTINGS 常量创建新的Intent以启动声音设置活动。

If you want to bring up the actual preferences screen that is usually available through system settings -- letting your user modify the phone's universal ringtone settings through your application -- you can use the ACTION_SOUND_SETTINGS constant from the android.provider.Settings class to create a new Intent to start the sound settings activity.

startActivityForResult(new Intent(android.provider.Settings.ACTION_SOUND_SETTINGS), 0);

如果要选择在应用程序中使用的自定义铃声,则需要添加<$ c您的 preferences.xml 定义文件中的$ c> RingtonePreference ,例如:

If you want to select a custom ringtone to use in your application you need to add a RingtonePreference in your preferences.xml definition file, like this:

<RingtonePreference
  android:key="alerts_ringtone"
  android:title="Select ringtone" 
  android:showDefault="true"
  android:showSilent="true"
  android:ringtoneType=""
/> 

您将能够在应用程序的默认<$ c $中获取所选首选项的URI。 c> SharedPreferences 使用 alerts_ringtone 作为密钥。

You'll be able to get the URI to the selected preference in the application's default SharedPreferences using alerts_ringtone as the key.

后一种技术使用 PreferenceActivity 类托管首选项。由于Android文档的写得很好,我在这里不做详细描述。 和一些示例代码。

The latter technique uses the PreferenceActivity class to host the preference options. I won't describe that in detail here, as the Android documentation has a good writeup and some sample code.

这篇关于转到设置屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆