如何打开Android中嵌套子preferenceScreen [英] How to open a nested child PreferenceScreen in Android

查看:744
本文介绍了如何打开Android中嵌套子preferenceScreen的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在XML中,供应所有的preferences我的应用程序定义的preferenceScreen。这preferenceScreen也有嵌套在一个子preferenceScreen。我的实现类被称为preferencesActivity。我知道我可以打开通过startActivity主要preferences窗口(新意图(这一点,preferencesActivity.class));但我怎么去通过一个Intent打开子preferenceScreen?

I have a PreferenceScreen that is defined in XML that serves all the preferences for my application. This PreferenceScreen also has a child PreferenceScreen nested within it. My implementing class is called PreferencesActivity. I know I can open the main Preferences window via startActivity(new Intent(this, PreferencesActivity.class)); but how do I go about opening the child PreferenceScreen via an Intent?

推荐答案

我对这个题目研究了一段时间我的项目盗窃感知(的 http://www.theftaware.com )(一点点广告... :-)我找到了解决办法:

i researched a while on this topic for my project Theft Aware (http://www.theftaware.com) (a little bit advertisement... :-) and i found the solution:

PreferenceScreen screen = getPreferenceScreen(); // gets the main preference screen     
screen.onItemClick(null, null, INDEX , 0); // click on the item

其中index为要在屏幕上打开该项目的位置

where INDEX is the position of the item you want to open on the screen

这篇关于如何打开Android中嵌套子preferenceScreen的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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