开发者

How to open a nested child PreferenceScreen in Android

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 P开发者_StackOverflowreferenceScreen via an Intent?


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

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


see this question for a more general solution based on Reinhard's idea, finally!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜