I've a TabActivity which sets up 10 tabs like this
intent = new Intent(this, typeof(recordTab5)); intent.AddFlags(ActivityFlags.NewTask); spec = TabHost.NewTabSpec("BoyRecord5"); spec.SetIndicator("Ref."); spec.SetContent(intent); TabHost.AddTab(spec);
I have a static class which contains List f (a list of class foo) and single instance of f called bar. Inside the main tab activity, I have
staticClass.bar = staticClass.foo;
This is fine and bar contains the first load of foo from the list.
In the Activity called from the intent for the tabs, I have the likes of
textView.Text = bar.Refs;
And again, this is fine.
The problem however is that in the main TabActivity I have a button that changes the contents of bar to the next in the List. The button does this, but the tab doesn't change.
I've looked around and there seems to be two solutions; first to change each tab to a view and second is to have the likes of
LocalActivityManager manager = getLocalActivityManager(); String currentTag = tab.getCurrentTabTag(); Class<? extends Activity> currentClass = manager.getCurrentActivity().getClass(); manager.removeAllActivities(); manager.startActivity(currentTag, new Intent(MasterHome.this,currentClass));
(the anon class needs to be changed as C# doesn't have anon classes and I don't have a clue on doing that!)
Does anyone have a nice simple way that I can refresh the tabviews with the new data? I've tried to invalidate the tabs, but that doesn't do anything.