Activity Lifecycle (onFreeze(), onCreate(), onPause())

General topics about the Android-Platform itself.
Coding issues please to the subforum right below.

Activity Lifecycle (onFreeze(), onCreate(), onPause())

Postby sowhat » Wed Jan 16, 2008 4:08 pm

Hello All,

I don't really unterstand the sense of OnFreeze() and the outState-Bundle.
The documentation says
onPause() Called when the system is about to start resuming a previous activity. This is typically used to commit unsaved changes to persistent data...

onFreeze() Allows you to save away your current state, when your activity is being paused and another one resuming to interact with the user. After being paused, the system may at any time need to stop (or even outright kill) your application in order to claim resources for the current foreground activity. If this should happen, the state you supply here will later be given back to you onCreate() when a new instance of your activity is started to interact with the user.

So why should I use onFreeze() with the outState-Bundle, which is only available to onCreate(), instead of always using onPause() and onResume()? Or what is the (semantic) difference between "saving away current state" (onFreeze()) and "commiting unsaved changes to persistend data..." (onPause()) ?

Thanks to everybod...
Once Poster
Once Poster
Posts: 1
Joined: Wed Jan 16, 2008 3:55 pm


Return to General

Who is online

Users browsing this forum: No registered users and 2 guests