3

I am using the android tv leanback sample here, https://github.com/googlesamples/androidtv-Leanback

when I try to replace fragment in MainFragment like this

getFragmentManager().beginTransaction().replace(R.id.main_frame, SampleFragment)
.addToBackStack(null).commit();

it crash with

android.support.v7.widget.RecyclerView$ViewHolder.shouldIgnore()’ on a null object reference at android.support.v7.widget.RecyclerView.findMinMaxChildLayoutPositions(RecyclerView.java:3989)

and it happens even I replace with a blank fragment

Kukic Vladimir
  • 1,010
  • 4
  • 15
  • 22
NoMoreWork
  • 31
  • 1

1 Answers1

0

Please follow the following pattern and it should help you resolve the issue. I had the same exact issue and took me awhile to figure it out finally.

 FragmentTransaction ft = fragmentManager.beginTransaction();
            ft.replace(R.id.fragment_container, destinationFragment, null);
            ft.commit();

Note: No need to add ".addToBackStack(null)"

Tekle
  • 176
  • 2
  • 7