RichardC wrote: > > http://developer.android.com/reference/android/app/Activity.html#isFinishing() > > latimerius wrote: >> >> Hello, >> >> I would like to be able to tell if Activity.onPause() was called because >> the user is leaving the app, or simply because another Activity within the >> same app is coming up. >> >> I have a main Activity and a PreferenceActivity. The main Activity needs >> to handle onPause() differently depending on why it's called. If the user >> is leaving the app, it needs to stop helper threads, close various things >> like analytics session, deal with GL, save data to SD card etc. However, >> if onPause() is just to display prefs most of that should happen, and a >> bunch of other things should be done instead. >> >> I'm wondering if there's a framework-supported way to handle this, or at >> least an idiomatic solution, as in a (semi)standard way of managing an >> Activity with heavy set-up and tear-down? >> > Also: "onDestroy(): Called before the activity is destroyed. This is the final call that the activity will receive. It could be called either because the activity is finishing (someone called finish()<http://developer.android.com/reference/android/app/Activity.html#finish()> on it), or because the system is temporarily destroying this instance of the activity to save space. You can distinguish between these two scenarios with the isFinishing()<http://developer.android.com/reference/android/app/Activity.html#isFinishing()> method." http://developer.android.com/guide/components/activities.html#Lifecycle
This passage doesn't reveal that 'isFinishing()' is available during 'onPause()', so it's good to have that Javadoc reference that RichardC shared. -- Lew -- -- You received this message because you are subscribed to the Google Groups "Android Developers" 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-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

