I would like to load XML preferences according to ap开发者_开发百科plication mode, like DEBUG, TEST or PRODUCION where different values are entered for the same keys.
Additionally the preferences default values must be set on start up.
This will allow easy testing in different circumstances.
Which is the best way to accomplish this.
PS: I don't want the user to see or have the option to change this settings.
You can add PreferenceCategory with say testCategory key and place all test related preferences tehere.
And if current mode is PRODUCTION, then just remove this testCategory from preferences in onCreate() function:
if(isProduction())
{
Preference testCategory = findPreference("testCategory");
getPreferenceScreen().removePreference(testCategory);
}
加载中,请稍侯......
精彩评论