Exemplo n.º 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            HelloMoonActivity.Context = this;
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_hello_moon);

            // Using a FrameLayout instead of a fragment in the activity_hellomoon.axml layout
            Fragment fragment = FragmentManager.FindFragmentById(Resource.Id.fragmentContainer);
            if (fragment == null) {
                fragment = new HelloMoonFragment();
                FragmentManager.BeginTransaction().Add(Resource.Id.fragmentContainer, fragment).Commit();

            }
        }
Exemplo n.º 2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            HelloMoonActivity.Context = this;
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_hello_moon);

            // Using a FrameLayout instead of a fragment in the activity_hellomoon.axml layout
            Fragment fragment = FragmentManager.FindFragmentById(Resource.Id.fragmentContainer);

            if (fragment == null)
            {
                fragment = new HelloMoonFragment();
                FragmentManager.BeginTransaction().Add(Resource.Id.fragmentContainer, fragment).Commit();
            }
        }