示例#1
0
        public static SettingsFragment NewInstance()
        {
            var frag4 = new SettingsFragment {
                Arguments = new Bundle()
            };

            return(frag4);
        }
示例#2
0
        void LoadFragment(int id)
        {
            //creating, linking and putting the keyboard into a bundle
            keyboard = FindViewById <Keyboard>(Resource.Id.keyboard_weights);
            Bundle mybundle = new Bundle();

            mybundle.PutSerializable("keyboard", keyboard);

            Android.Support.V4.App.Fragment fragment = null;
            //int title = 0;
            switch (id)
            {
            case Resource.Id.action_home:
                fragment           = HomeFragment.NewInstance();
                fragment.Arguments = mybundle;
                //title = Resource.String.home;
                break;

            case Resource.Id.action_calender:
                fragment = CalendarFragment.NewInstance();
                //title = Resource.String.calendar;
                break;

            case Resource.Id.action_workout:
                fragment = WorkoutFragment.NewInstance();
                //title = Resource.String.workout;
                break;

            case Resource.Id.action_settings:
                fragment = SettingsFragment.NewInstance();
                //title = Resource.String.settings;
                break;
            }
            if (fragment == null)
            {
                return;
            }

            SupportFragmentManager.BeginTransaction()
            .Replace(Resource.Id.content_frame, fragment)
            .Commit();

            //if (title!=0) SupportActionBar.SetTitle(title);
        }