Ejemplo n.º 1
0
            public static Fragment NewInstance()
            {
                Fragment fragment = new DisplayFragment();

                fragment.RetainInstance = true;
                return(fragment);
            }
Ejemplo n.º 2
0
        private void selectItem(int position)
        {
            // update the main content by replacing fragments
            var fragment = DisplayFragment.NewInstance();

            if (position == 0)
            {
                fragment = DisplayFragment.NewInstance();
            }
            else if (position == 1)
            {
                fragment = SettingsFragment.NewInstance();
            }
            else if (position == 2)
            {
                fragment = HelpFragment.NewInstance();
            }

            var fragmentManager = this.FragmentManager;
            var ft = fragmentManager.BeginTransaction();

            ft.Replace(Resource.Id.content_frame, fragment);
            ft.Commit();

            // update selected item title, then close the drawer
            mDrawerLayout.CloseDrawer(mDrawerList);
        }