【发布时间】:2017-12-11 15:42:30
【问题描述】:
我正在使用 this BrowseFragment(Leanback Showcase 中的 PageAndListRowFragment)为我的 android TV 应用中的每个标题项添加多行。现在我无法刷新此片段中的数据。一切正常。我将提供一个示例,我如何设置数据以及如何尝试刷新数据。
这是我的onCreate
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setupUi();
loadData();
mBackgroundManager = BackgroundManager.getInstance(getActivity());
mBackgroundManager.attach(getActivity().getWindow());
getMainFragmentRegistry().registerFragment(PageRow.class, new PageRowFragmentFactory(mBackgroundManager, myObject));
}
我已将myObject 传递到 PageRowFragmentFactory,这就是我将数据传递到我的片段中的方式。当我刷新数据时(我在 onCreate 中用不同的数据做同样的事情)
getMainFragmentRegistry().registerFragment(PageRow.class,new PageRowFragmentFactory(mBackgroundManager,myObject));
数据从未刷新,重要的是 PageRowFragmentFactory 中的createFragment() 方法没有调用(不是第一次刷新时)。可能是什么问题?
【问题讨论】:
标签: android android-fragments leanback browsefragment