void LoadFragment(int id)
        {
            Android.Support.V4.App.Fragment fragment = null;
            switch (id)
            {
            case Resource.Id.menu_home:
                fragment = Fragment1.NewInstance();
                break;

            case Resource.Id.menu_audio:
                fragment = Fragment2.NewInstance();
                break;

            case Resource.Id.menu_video:
                fragment = Fragment3.NewInstance();
                break;
            }
            if (fragment == null)
            {
                return;
            }

            SupportFragmentManager.BeginTransaction()
            .Replace(Resource.Id.content_frame, fragment)
            .Commit();
        }
Exemple #2
0
        private void ListItemClicked(int position)
        {
            //this way we don't load twice, but you might want to modify this a bit.
            if (position == oldPosition)
            {
                return;
            }

            oldPosition = position;

            Android.Support.V4.App.Fragment fragment = null;
            switch (position)
            {
            case 0:
                fragment = Fragment1.NewInstance();
                break;

            case 1:
                fragment = Fragment2.NewInstance();
                break;
            }

            SupportFragmentManager.BeginTransaction()
            .Replace(Resource.Id.content_frame, fragment)
            .Commit();
        }
            public override Android.Support.V4.App.Fragment GetItem(int position)
            {
                switch (position)
                {
                case 0:
                    return(Fragment1.NewInstance());

                case 1:
                    return(Fragment2.NewInstance());
                }
                return(null);
            }