开发者

How to open a nested child PreferenceScreen in Android

开发者 https://www.devze.com 2022-12-31 21:57 出处:网络
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

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

精彩评论

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

关注公众号