用它代替&QUOT什么;增加preferencesFromResource"在preferenceActivity? [英] What to use instead of "addPreferencesFromResource" in a PreferenceActivity?
问题描述
我只注意到一个事实,即该方法添加preferencesFromResource(INT preferencesResId)
标记德precated 在Android的文件(<一href="http://developer.android.com/reference/android/$p$pference/$p$pferenceActivity.html#add$p$pferencesFromResource%28int%29">Reference进入)。
I just noticed the fact that the method addPreferencesFromResource(int preferencesResId)
is marked deprecated in Android's documentation (Reference Entry).
不幸的是没有替代方法,在方法的描述中提供。
Unfortunately no alternative method is provided in the method's description.
应该使用以连接preferenceScreen.xml到匹配preferenceActivity哪种方法?
Which method should be used instead in order to connect a preferenceScreen.xml to the matching PreferenceActivity?
非常感谢你的帮助。
推荐答案
没有替代方法,在方法的描述中提供,因为preferred方法(如API级别11)是实例<一href="http://developer.android.com/reference/android/$p$pference/$p$pferenceFragment.html">$p$pferenceFragment对象从资源文件加载preferences。见样品code在这里:<一href="http://developer.android.com/reference/android/$p$pference/$p$pferenceActivity.html">$p$pferenceActivity
No alternative method is provided in the method's description because the preferred approach (as of API level 11) is to instantiate PreferenceFragment objects to load your preferences from a resource file. See the sample code here: PreferenceActivity
这篇关于用它代替&QUOT什么;增加preferencesFromResource&QUOT;在preferenceActivity?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!