Use following code to set current fragment to backstack and load new fragment
PdfFragment newFragment = new PdfFragment();
Bundle args = new Bundle();
args.putString("name", sub_category.name);
args.putString("catId", String.valueOf(sub_category.id));
args.putString("pdf_from", "sub_category");
newFragment.setArguments(args);
FragmentTransaction transaction = getSupportFragmentManager()
.beginTransaction();
// Replace whatever is in the fragment_container view with this
// fragment,
// and add the transaction to the back stack so the user can
// navigate back
transaction.setCustomAnimations(R.anim.left_to_right,
R.anim.right_to_left);
transaction.replace(R.id.fragment_container, newFragment);
// use following code to set current fragment to back stack and load new fragment
transaction.addToBackStack(null);
// Commit the transaction
transaction.commit();
No comments :
Post a Comment