예제 #1
0
        public static TFragment FindFragmentByTag <TFragment>(this MvxActivity activity, string tag)
            where TFragment : Fragment
        {
            var fragment = activity.FragmentManager.FindFragmentByTag(tag);

            if (fragment == null)
            {
                Mvx.Warning("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 MvxActivity activity, int resourceId)
            where TFragment : Fragment
        {
            var fragment = activity.FragmentManager.FindFragmentById(resourceId);

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

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