private void openEnglish(object sender, System.EventArgs e) { Fragment fragment = new English.EnglishHomeFragment(); var fragmentTransaction = FragmentManager.BeginTransaction(); fragmentTransaction.Replace(Resource.Id.framecontainer, fragment); fragmentTransaction.AddToBackStack(null); fragmentTransaction.Commit(); }
public bool OnNavigationItemSelected(IMenuItem item) { var id = item.ItemId; Fragment fragment = null; switch (id) { default: break; case Resource.Id.nav_home: fragment = new Fragments.HomeFragment(); break; case Resource.Id.nav_english: fragment = new Fragments.English.EnglishHomeFragment(); break; case Resource.Id.nav_maths: fragment = new Fragments.Maths.MathsHomeFragment(); break; case Resource.Id.nav_geography: break; case Resource.Id.nav_history: break; case Resource.Id.nav_computing: fragment = new Fragments.Computing.ComputingHomeFragment(); break; case Resource.Id.nav_share: break; case Resource.Id.nav_feedback: sendFeedback(); return(false); case Resource.Id.nav_about: break; } if (fragment != null) { //home_fragment var fragmentTransaction = FragmentManager.BeginTransaction(); fragmentTransaction.Replace(Resource.Id.framecontainer, fragment); fragmentTransaction.AddToBackStack(null); fragmentTransaction.Commit(); var drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); drawer.CloseDrawer(GravityCompat.Start); return(true); } else { Common.notImplementedWarning(FindViewById(Android.Resource.Id.Content), ApplicationContext); return(false); } }