Fragmenttransaction Inside A Fragment
I am using jfeinstien10's SlidingMenu. The menu that pulls out is a Fragment. When the user clicks on a menu item, it does something like this: FragmentTransaction t = getActivit
Solution 1:
Instead of performing transaction in fragment, I would suggest you to leave it up to Activity level. To do that, define a public method in your activity and then call it from your fragment. For example:
Suppose your activity is:
classMainActivityextendsActivity{
....
publicvoidreplaceFragment(){
FragmentTransactiont= getSupportFragmentManager().beginTransaction();
SherlockListFragmentmFrag=newItemsFragment();
t.replace(R.id.main_frag, mFrag);
t.commit();
}
....
}
And within your fragment, make the following call:
((MainActivity)getActivity()).replaceFragment();
Post a Comment for "Fragmenttransaction Inside A Fragment"