Dave
Dave

Reputation: 1950

Android event when switching to an activity from a tab, not sure how OnTabChangeListener would work

this is a rough idea of what my program looks like

MainTabHost Activity (startup)

===> Tab1 (activity1.java)

         public void refresh();

===> Tab2 (activity2.java)

I have a refresh function on activity1 that repaints a listview. If I switch to Tab2, then switch back to Tab1, I need an event to call that function.

All the examples for OnTabChangeListener involve defining the event at the startup activity.. however at that level, I'm not sure how to invoke a function in activity1/2 ?

thanks in advance

Upvotes: 0

Views: 339

Answers (1)

Noel
Noel

Reputation: 7410

I have not used TabActivity but I would assume that onResume() gets called when you switch to a new activity as per the android activity lifecycle. Could you do your refresh() in the onResume() of your tab1 activity?

Upvotes: 1

Related Questions