Hmm, I'm definitely seeing onResume getting called in a quick test app with logging of life cycle methods for the activities in the tabs.
That said, you can get even more life cycle methods called each time by using the Intent.FLAG_ACTIVITY_CLEAR_TOP flag like in the API demos: http://developer.android.com/intl/zh-CN/guide/samples/ApiDemos/src/com/example/android/apis/view/Tabs3.html I'll attach the logs below for starting on the first tab, then going to the others in this order: second, third, first, second, third The activity for the third tab is being launched with the clear top flag. I/LifeCycleLogger: first tab( 1904): onCreate I/LifeCycleLogger: first tab( 1904): onContentChanged I/LifeCycleLogger: first tab( 1904): onStart I/LifeCycleLogger: first tab( 1904): onPostCreate I/LifeCycleLogger: first tab( 1904): onResume I/LifeCycleLogger: first tab( 1904): onPostResume I/LifeCycleLogger: tabs( 1904): Startup and showing first tab complete. I/LifeCycleLogger: first tab( 1904): onSaveInstanceState I/LifeCycleLogger: first tab( 1904): onPause I/LifeCycleLogger: second tab( 1904): onCreate I/LifeCycleLogger: second tab( 1904): onContentChanged I/LifeCycleLogger: second tab( 1904): onStart I/LifeCycleLogger: second tab( 1904): onPostCreate I/LifeCycleLogger: second tab( 1904): onResume I/LifeCycleLogger: second tab( 1904): onPostResume I/LifeCycleLogger: tabs( 1904): Changed to tab: second tab I/LifeCycleLogger: second tab( 1904): onSaveInstanceState I/LifeCycleLogger: second tab( 1904): onPause I/LifeCycleLogger: third tab( 1904): onCreate I/LifeCycleLogger: third tab( 1904): onContentChanged I/LifeCycleLogger: third tab( 1904): onStart I/LifeCycleLogger: third tab( 1904): onPostCreate I/LifeCycleLogger: third tab( 1904): onResume I/LifeCycleLogger: third tab( 1904): onPostResume I/LifeCycleLogger: tabs( 1904): Changed to tab: third tab I/LifeCycleLogger: third tab( 1904): onSaveInstanceState I/LifeCycleLogger: third tab( 1904): onPause I/LifeCycleLogger: first tab( 1904): onResume I/LifeCycleLogger: first tab( 1904): onPostResume I/LifeCycleLogger: tabs( 1904): Changed to tab: first tab I/LifeCycleLogger: first tab( 1904): onSaveInstanceState I/LifeCycleLogger: first tab( 1904): onPause I/LifeCycleLogger: second tab( 1904): onResume I/LifeCycleLogger: second tab( 1904): onPostResume I/LifeCycleLogger: tabs( 1904): Changed to tab: second tab I/LifeCycleLogger: second tab( 1904): onSaveInstanceState I/LifeCycleLogger: second tab( 1904): onPause I/LifeCycleLogger: third tab( 1904): onStop I/LifeCycleLogger: third tab( 1904): onDestroy I/LifeCycleLogger: third tab( 1904): onCreate I/LifeCycleLogger: third tab( 1904): onContentChanged I/LifeCycleLogger: third tab( 1904): onStart I/LifeCycleLogger: third tab( 1904): onPostCreate I/LifeCycleLogger: third tab( 1904): onResume I/LifeCycleLogger: third tab( 1904): onPostResume I/LifeCycleLogger: tabs( 1904): Changed to tab: third tab On Nov 20, 1:40 pm, JasonMP <[email protected]> wrote: > presumably, except my code that I place in the onResume never gets run > when the tabs are switched. > > On Nov 20, 1:27 pm, Lance Nanek <[email protected]> wrote: > > > Doesn't onPause get called on the activity whose tab you are leaving > > and onResume get called for the activity whose tab you are going to? > > > On Nov 20, 11:22 am, JasonMP <[email protected]> wrote: > > > > Eddie, > > > > The onTabChanged must be called from with my main TabActivity correct? > > > > If this is the case this isn't the solution I'm looking for. I have a > > > TabHost that run a new activity in a tab. From within that activity I > > > will the screen with a ListView. I need to be able to refresh that > > > ListView each time the user selects that tab. > > > > On Nov 20, 10:25 am, JasonMP <[email protected]> wrote: > > > > > Hey, Thanks Eddie. > > > > > On Nov 20, 10:18 am, Smelly Eddie <[email protected]> wrote: > > > > > > Hmmm.. > > > > > > If only the documentation clearly outlined some sort of 'onTabChanged' > > > > > listener.... well that would be exactly what you need. > > > > > > Shame that the SDK reference doesn't have a pge liek this > > > > > one,http://developer.android.com/reference/android/widget/TabHost.OnTabCh... > > > > > that introduces such a method. > > > > > > Yes, I am being sarcastic. RTFM > > > > > > On Nov 19, 3:39 pm, JasonMP <[email protected]> wrote: > > > > > > > Hi, > > > > > > I have an app that is broken up int a few tabs across the top. Each > > > > > > tab runs an activity that modifies different areas of my database. > > > > > > What I'm trying to accomplish is that each time a user changes > > > > > > tabs, i > > > > > > want to be able to run some code to update the displays with any new > > > > > > information from the database. How do I specify that a specific > > > > > > function is supposed to run when the tab is activated? the > > > > > > onStart()/ > > > > > > onCreate() dont seem to be doing it. -- You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en

