コード例 #1
0
        public static TFragment FindFragmentByTag <TFragment>(this MvxFragmentActivity activity, string tag)
            where TFragment : Fragment
        {
            var fragment = activity.SupportFragmentManager.FindFragmentByTag(tag);

            if (fragment == null)
            {
                MvxAndroidLog.Instance.Warn("Failed to find fragment tag {0} in {1}", tag, activity.GetType().Name);
                return(default(TFragment));
            }

            return(SafeCast <TFragment>(fragment));
        }
コード例 #2
0
        public static TFragment FindFragmentById <TFragment>(this MvxFragmentActivity activity, int resourceId)
            where TFragment : Fragment
        {
            var fragment = activity.SupportFragmentManager.FindFragmentById(resourceId);

            if (fragment == null)
            {
                MvxAndroidLog.Instance.Warn("Failed to find fragment id {0} in {1}", resourceId, activity.GetType().Name);
                return(default(TFragment));
            }

            return(SafeCast <TFragment>(fragment));
        }