机器人 - 进入设置界面 [英] android - go to settings screen

查看:114
本文介绍了机器人 - 进入设置界面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想打开设置 - >声音和放大器;显示 - >手机铃声屏幕从我的应用程序。我该怎么办呢?

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' screen from your application.

如果你想提出的实际preferences屏幕通常可通过系统设置 - 让您的用户通过应用程序修改手机的普遍铃声设置 - 您可以使用 ACTION_SOUND_SETTINGS 从常数 android.provider.Settings 类来创建一个新的意图,开始声音设置活动。

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);

如果你想选择一个自定义铃声的应用程序中使用,你需要添加一个铃声preference preferences.xml 定义文件,像这样的:

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=""
/>

您将能够共享preferences 使用 alerts_ringtone <拿到URI来选定preference在应用程序的默认/ code>的关键。

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 班举办preference选项。我就不一一介绍了,在这里详细,因为Android的文件有良好的书面记录以及一些示例code

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天全站免登陆