Last active
December 8, 2015 09:46
-
-
Save enginebai/760a05533d7554db4537 to your computer and use it in GitHub Desktop.
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
@Override | |
public void onNavigationDrawerItemSelected(int position) { | |
// update the main content by replacing fragments | |
FragmentManager fragmentManager = getSupportFragmentManager(); | |
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); | |
Fragment fragment; | |
String fragmentTag; | |
switch (position) { | |
case 0: | |
fragment = MoviePageFragment.newInstance(); | |
fragmentTag = MoviePageFragment.class.getSimpleName(); | |
break; | |
default: | |
fragment = PlaceholderFragment.newInstance(position + 1); | |
fragmentTag = PlaceholderFragment.class.getSimpleName(); | |
} | |
fragmentTransaction | |
.replace(R.id.container, fragment, fragmentTag) | |
.commit(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment