addPreferencesFromResource 过期问题

轩夜 2012-06-07 12:22:31

public class PreferenceActivityTest extends PreferenceActivity
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);

//The method addPreferencesFromResource(int) from the type PreferenceActivity is deprecated
addPreferencesFromResource(R.xml.preferences);
}
}

其中addPreferencesFromResource过期了
我想知道需要将其替换成哪一个Method。或者其他解决办法。
...全文
3775 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
握固 2012-07-03
  • 打赏
  • 举报
回复
This is the base class for an activity to show a hierarchy of preferences to the user. Prior to HONEYCOMB this class only allowed the display of a single set of preference; this functionality should now be found in the new PreferenceFragment class. If you are using PreferenceActivity in its old mode, the documentation there applies to the deprecated APIs here.

也就是说,现在推荐用PreferenceFragment类了,因此没有在PrefernceActivity类中列出替代方法。

80,493

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧