Skip to content

Instantly share code, notes, and snippets.

@prdpspkt
Created October 29, 2018 04:45
Show Gist options
  • Save prdpspkt/0f6454cf61f86236a336fd6ff3e765af to your computer and use it in GitHub Desktop.
Save prdpspkt/0f6454cf61f86236a336fd6ff3e765af to your computer and use it in GitHub Desktop.
Loading another fragment in Navigation Drawer Activity Dynamically.
Fragment fragment = null;
Class fragmentClass = null;
fragmentClass = NoticeFragment.class;
try {
fragment = (Fragment) fragmentClass.newInstance();
} catch (Exception e) {
e.printStackTrace();
}
FragmentManager fragmentManager = getSupportFragmentManager();
fragmentManager.beginTransaction().replace(R.id.flContent, fragment).commit();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment