我正在使用this BrowseFragment( PageAndListRowFragment in Leanback Showcase )为我的Android电视应用中的每个 Headers 项添加多行 . 现在,我可以提供一个示例,说明如何设置数据以及如何尝试刷新数据 . 这是我的 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()
方法没有调用(当刷新不是第一次时) . 可能是什么问题?