Reputation: 13
My code is as follows:-
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.fragment_container, mFeedFragment);
fragmentTransaction.addToBackStack(null);
fragmentTransaction.commit();
Upvotes: 1
Views: 75
Reputation: 496
1) You may be giving wrong handle to the FrameLayout in the view for your activity.
2) You may be mixing Activity, AppCompatActivity, getFragmentManager and getSupportFragmentManager. If your activity is inheriting Activity use getFragmentManager, or if it is using AppCompatActivity use getSupportFragmentManager.
Upvotes: 0
Reputation: 1648
Please start by following the best practices, like using Fragment from Support package and using getSupportFragmentManager() instead of getFragmentManager()
Take one step at a time. The above piece of is insufficient for me to provide more information than this.
Upvotes: 0
Reputation: 122
This is bit weird but it works.
just add android:background="#FFFFFF" attribute to your root layout of the fragment and it will show properly. been there done that.
Upvotes: 1