scenario:
I have the mainActivity
in which it holds the default game list fragment
When user clicks an item on the list it should show the FragmentActivity
that contains a viewpager with two tabs inside the framelayout
basically replacing the default game list fragment
.
question: how can I add FragmentActivity
to the FrameLayout
?
what I have tried:
//this throws an error because the fragment cannot be casted to `FragmentActivity`
Fragment fragment = (NewsTopicsFragment) ft.findFragmentById(R.id.container);
//Fragment mNewsTopicsFragment =(Fragment) new NewsTopicsFragment();
//mNewsTopicsFragment.setGame(mGame);
getActivity()
.getSupportFragmentManager().beginTransaction()
.replace(R.id.container, mNewsTopicsFragment)
.commit();