Example #1
0
        private FragmentTransaction OnTabSelected(object content, FragmentTransaction ft)
        {
#if !API8
            var fragment = content as Fragment;
            if (fragment != null)
            {
                if (ft == null)
                {
                    var fragmentManager = _tabHost.GetFragmentManager();
                    if (fragmentManager == null)
                    {
                        return(null);
                    }
                    ft = fragmentManager.BeginTransaction();
                }

                if (fragment.IsDetached)
                {
                    return(ft.Attach(fragment));
                }
                return(ft.Replace(_tabHost.TabContentView.Id, fragment));
            }
#endif
            var view = content as View;
            if (view == null)
            {
                _tabHost.TabContentView.RemoveAllViews();
            }
            else
            {
                _tabHost.TabContentView.AddView(view);
            }
            return(null);
        }