Updating tabviews

nodoidnodoid GBMember, Beta ✭✭✭


I've a TabActivity which sets up 10 tabs like this

intent = new Intent(this, typeof(recordTab5));
            spec = TabHost.NewTabSpec("BoyRecord5");

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[0];

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.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.




  • IvanHarrisIvanHarris USMember ✭✭✭

    From what I read in your post, you just need to refresh your list within one of your tabs.

    One of my apps has tabs. Within one of the tabs, I have a list. To refresh the list, I just use OnResume.

    So, each time the activity/tab selected is shown. The list is refreshed. Within your activity (recordTab5) do this:

        protected override void OnResume()

    If you want to display a different tab:

        TabHost.CurrentTab = 5;
Sign In or Register to comment.