Last active
September 5, 2015 11:39
-
-
Save danielwilson1702/ea0fb5213e75e65653d3 to your computer and use it in GitHub Desktop.
Swapping a fragment - standard
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bundle args = launchingFragment.getArguments(); | |
if (args == null) { | |
args = new Bundle(); | |
} | |
if (mMyObject != null) { | |
args.putSerializable(Constants.Args.MY_OBJECT, mMyObject); | |
} | |
Fragment myNiceFragment = MyNiceFragment.instantiate(mContext, MyNiceFragment.class.getName(), args); | |
getSupportFragmentManager().beginTransaction() | |
.replace(R.id.content_container, myNiceFragment, myNiceFragment.getClass().getSimpleName()) | |
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN) | |
.addToBackStack(null) | |
.commit(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment