Can't refresh data in BrowseFragment

364 Views Asked by At

I'm using this BrowseFragment (PageAndListRowFragment in Leanback Showcase) to add multiple rows for each header item in my android TV app. now I can't refresh data in this fragment.Everything is working properly. I'll provide an example how I set the data and how I tried to refresh the data. this is my 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));
}

I've passed myObject into PageRowFragmentFactory, That's how i pass data into my fragments. When I refresh the data (I do the same thing in onCreate with different data)

getMainFragmentRegistry().registerFragment(PageRow.class,new PageRowFragmentFactory(mBackgroundManager,myObject));

data never refreshed, and the important thing is createFragment() method in PageRowFragmentFactory is not calling (when refresh not first time). What could be the issue?

1

There are 1 best solutions below

0
A_rmas On

just pass the datas in the fragment you use in fragment factory. You dont always need to pass the datas as arguments.I suggest you to use setters then check if fragment is created then notify dataset changes.