protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.activity_archive); userId = Intent.GetStringExtra("UserId"); data = new DatabaseHelper(ApplicationContext); sppiner = FindViewById <Spinner> (Resource.Id.spCompanyArchive); GetCompany(Convert.ToInt32(userId)); InitializeTabs(bundle); sIS = bundle; sppiner.ItemSelected += delegate(object sender, AdapterView.ItemSelectedEventArgs e) { InitializeTabs(sIS); kompania = sppiner.GetItemAtPosition(e.Position).ToString(); companyList = data.GetCompanyId(kompania); companyId = companyList [0].CompanyId; List <Evidence> tData = data.GetEvidenceUserCompanyList(Convert.ToInt32(userId), companyId); if (tData.Count <= 0) { tabHost.ClearAllTabs(); return; } else { tabHost.ClearAllTabs(); LoadTabs(); } }; }
public override void OnConfigurationChanged(Configuration newConfig) { base.OnConfigurationChanged(newConfig); TabHost tabHost = this.TabHost; tabHost.ClearAllTabs(); SetContentView(Resource.Layout.Main); InitaliseTabs(); }
protected override void Refresh() { string selectedTag = _tabHost.CurrentTabTag; var oldValues = new Dictionary <string, TabInfo>(_tabToContent); _tabHost.CurrentTab = 0; _tabHost.ClearAllTabs(); _tabToContent.Clear(); int count = ItemsSource.Count(); for (int i = 0; i < count; i++) { var tabInfo = TryRecreateTabInfo(i, oldValues); _tabHost.AddTab(tabInfo.TabSpec); } foreach (var oldValue in oldValues) { RemoveTab(oldValue.Value); } if (count == 0) { OnEmptyTab(); } else { if (selectedTag == null) { _tabHost.CurrentTab = 0; if (_selectedItemMember != null) { _selectedItemMember.SetValue(_tabHost, new[] { GetItem(0) }); } } else { _tabHost.SetCurrentTabByTag(selectedTag); } } }
protected override void Refresh() { try { _ingoreTabChanged = true; string oldTag = TabHost.CurrentTabTag; var oldValues = new Dictionary <string, TabInfo>(_tabToContent); var oldIndex = TabHost.CurrentTab; _tabToContent.Clear(); var manager = GetCollectionViewManager(); if (manager == null) { TabHost.CurrentTab = 0; TabHost.ClearAllTabs(); } else { manager.Clear(TabHost); } int count = ItemsSource.Count(); for (int i = 0; i < count; i++) { var tabInfo = TryRecreateTabInfo(i, oldValues); if (manager == null) { TabHost.AddTab(tabInfo.TabSpec); } else { manager.Insert(TabHost, i, tabInfo.TabSpec); } } foreach (var oldValue in oldValues) { RemoveTabDelegate(this, oldValue.Value); } _ingoreTabChanged = false; if (count == 0) { OnEmptyTab(); } else { if (oldTag != null && _tabToContent.ContainsKey(oldTag)) { TabHost.SetCurrentTabByTag(oldTag); } else { var maxIndex = TabHost.TabWidget.TabCount - 1; while (oldIndex > maxIndex) { --oldIndex; } if (oldIndex >= 0) { TabHost.CurrentTab = oldIndex; } oldTag = TabHost.CurrentTabTag; } OnTabChanged(oldTag); } } finally { _ingoreTabChanged = false; } }