internal static void addTab(SamplePlanningActivity activity, TabHost tabHost, TabHost.TabSpec tabSpec, TabInfo tabInfo)
        {
            // Attach a Tab view factory to the spec
            tabSpec.SetContent(new TabFactory(activity));
            String tag = tabSpec.Tag;

            // Check to see if we already have a fragment for this tab, probably
            // from a previously saved state.  If so, deactivate it, because our
            // initial state is that a tab isn't shown.
            tabInfo.fragment = activity.SupportFragmentManager.FindFragmentByTag(tag);
            if (tabInfo.fragment != null && !tabInfo.fragment.IsDetached)
            {
                Android.Support.V4.App.FragmentTransaction ft = activity.SupportFragmentManager.BeginTransaction();
                ft.Detach(tabInfo.fragment);
                ft.Commit();
                activity.SupportFragmentManager.ExecutePendingTransactions();
            }

            tabHost.AddTab(tabSpec);
        }
        private void initialiseTabHost(Bundle args)
        {
            mTabHost = (TabHost)FindViewById(Android.Resource.Id.TabHost);
            mTabHost.Setup();
            TabInfo tabInfo = null;

            SamplePlanningActivity.addTab(this, this.mTabHost, this.mTabHost.NewTabSpec("Tab1").SetIndicator("Not Received"),
                                          (tabInfo = new TabInfo("Tab1", typeof(SampleNotReceived), args != null ? args : new Bundle())));

            this.mapTabInfo.Add(tabInfo.tag, tabInfo);

            SamplePlanningActivity.addTab(this, this.mTabHost, this.mTabHost.NewTabSpec("Tab2").SetIndicator("Not Delivered"),
                                          (tabInfo = new TabInfo("Tab2", typeof(SampleNotDelivered), args != null ? args : new Bundle())));
            this.mapTabInfo.Add(tabInfo.tag, tabInfo);
            SamplePlanningActivity.addTab(this, this.mTabHost, this.mTabHost.NewTabSpec("Tab3").SetIndicator("Upcoming"),
                                          (tabInfo = new TabInfo("Tab3", typeof(SampleUpcomoing), args != null ? args : new Bundle())));
            this.mapTabInfo.Add(tabInfo.tag, tabInfo);
            // Default to first tab
            this.OnTabChanged("Tab1");
            //
            mTabHost.SetOnTabChangedListener(this);
        }