private void ResBtn_Click(object sender, EventArgs e) { RestConFragment fragB = new RestConFragment(); FragmentManager.BeginTransaction().Replace(Resource.Id._main_, fragB).Commit(); //var trans = FragmentManager.BeginTransaction().Replace(Resource.Id._main_, new RestConFragment(), null).AddToBackStack(null).Commit(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_dashboard); // HomeButton_Click; resFragment = new ResFragment(); homeFragment = new HomeFragment(); restconFragment = new RestConFragment(); myresFragment = new MyRestaurantFragment(); mStackFragments = new Stack <SupportFragment>(); drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); // Create ActionBarDrawerToggle button and add it to the toolbar toolbar = FindViewById <V7Toolbar>(Resource.Id.toolbar); toolbar.SetNavigationIcon(Resource.Drawable.loginlogos); toolbar.SetTitle(Resource.String.app_home); SetSupportActionBar(toolbar); // var drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, Resource.String.drawer_open, Resource.String.drawer_close); drawerLayout.SetDrawerListener(drawerToggle); drawerToggle.SyncState(); navigationView = FindViewById <NavigationView>(Resource.Id.nav_view); navigationView.NavigationItemSelected += NavigationView_NavigationItemSelected1; //setupDrawerContent(navigationView); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.menuicon); Android.Support.V4.App.FragmentTransaction tx = SupportFragmentManager.BeginTransaction(); tx.Add(Resource.Id._main_, resFragment); tx.Add(Resource.Id._main_, homeFragment); tx.Add(Resource.Id._main_, myresFragment); tx.Hide(resFragment); tx.Hide(myresFragment); //tx.Hide(restconFragment); mCurrentFragment = homeFragment; tx.Commit(); }
public static Android.Support.V4.App.Fragment newInstance(Context context) { RestConFragment busrouteFragment = new RestConFragment(); return(busrouteFragment); }