Created
June 15, 2013 00:07
-
-
Save wesleyfsmith/5786184 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| public void showFragment(ParentFragment fragment, int transition, int containerViewId) { | |
| FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); | |
| if (containerViewId == NO_CONTAINER) { | |
| containerViewId = R.id.activity_root; | |
| } | |
| if (currentFragment == null) { | |
| fragmentTransaction.add(containerViewId, fragment); | |
| } else { | |
| fragmentTransaction.replace(containerViewId, fragment); | |
| } | |
| fragmentTransaction.setTransition(transition); | |
| addToBackStack(fragment.getClass().getName(), fragmentTransaction); | |
| fragmentTransaction.commit(); | |
| currentFragment = fragment; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment