Ejemplo n.º 1
0
        void LoadFragment(int id)
        {
            Fragment fragment = null;

            switch (id)
            {
            case Resource.Id.action_home:
                fragment = Fragment1.NewInstance();
                break;

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

            case Resource.Id.action_messages:
                fragment = Fragment3.NewInstance();
                break;

            case Resource.Id.action_settings:
                fragment = Fragment4.NewInstance();
                break;

            default:
                break;
            }

            if (fragment == null)
            {
                return;
            }

            FragmentManager.BeginTransaction()
            .Replace(Resource.Id.fragmentContainer, fragment)
            .Commit();
        }
Ejemplo n.º 2
0
        public static Fragment4 NewInstance()
        {
            var frag4 = new Fragment4 {
                Arguments = new Bundle()
            };

            return(frag4);
        }