Example #1
0
        void ShowEmbeddedPageFragment(Fragment fragment)
        {
            FragmentTransaction ft = SupportFragmentManager.BeginTransaction();

            ft.AddToBackStack(null);
            ft.Replace(Resource.Id.fragment_frame_layout, fragment, "hello");

            ft.Commit();
        }
        public void OnChanged(Java.Lang.Object p0)
        {
            SMInAppContentUrlFragment inAppContentUrlFragment = SMInAppContentUrlFragment.NewInstance("MAIN");

            inAppContentUrlFragment.Refresh();

            //You can check if there is content.
            if (inAppContentUrlFragment.HasContent)
            {
                AndroidX.Fragment.App.FragmentTransaction fragmentTransaction = _fragmentManager.BeginTransaction();
                fragmentTransaction.Replace(Resource.Id.main_fragment_url, inAppContentUrlFragment);
                fragmentTransaction.Commit();
            }
            else
            {
                //There is no content, so you can display something else instead of the fragment if you want.
                //You can also listen to the broadcast sent after receiving In App Contents (cf. class EventReceiver) and,
                // if there is content for this category, then display the fragment.

                //Do stuff...
            }
        }