Exemplo n.º 1
0
        public static Fragment2 NewInstance()
        {
            var frag2 = new Fragment2 {
                Arguments = new Bundle()
            };

            return(frag2);
        }
Exemplo n.º 2
0
        public bool OnNavigationItemSelected(IMenuItem item)
        {
            int      id       = item.ItemId;
            Fragment fragment = null;

            //    if (id == null)
            //{
            //    Toast.MakeText(this,"Hora Ramces Maradiaga",ToastLength.Long).Show();
            //}
            if (id == Resource.Id.nav_camera)
            {
                // Handle the camera action
                //FragmentTransaction ft = FragmentManager.BeginTransaction();
                //Fragment1 f1 = new Fragment1();
                //ft.Replace(Resource.Id.drawer_layout, f1);
                //ft.AddToBackStack(null);
                //ft.Commit();


                var prueba = Fragment1.NewInstance();
                //FragmentManager.BeginTransaction().Replace( Android.Resource.Id.Content,prueba).Commit();
                FragmentManager.BeginTransaction().Replace(Resource.Id.contenedor, prueba).Commit();
            }
            else if (id == Resource.Id.nav_gallery)
            {
                var prueba2 = Fragment2.NewInstance();
                //FragmentManager.BeginTransaction().Replace( Android.Resource.Id.Content,prueba).Commit();
                FragmentManager.BeginTransaction().Replace(Resource.Id.contenedor, prueba2).Commit();
            }
            else if (id == Resource.Id.nav_slideshow)
            {
            }
            else if (id == Resource.Id.nav_manage)
            {
            }
            else if (id == Resource.Id.nav_share)
            {
            }
            else if (id == Resource.Id.nav_send)
            {
            }

            DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);

            drawer.CloseDrawer(GravityCompat.Start);
            return(true);
        }