Using Activity Callbacks to Manage Application State and Resources

Different important state changes within the Activity lifecycle are punctuated by a series of important method callbacks.These callbacks are shown in Figure 4.3.

Here are the method stubs for the most important callbacks of the Activity class:

public class MyActivity extends Activity {

protected void onCreate(Bundle savedlnstanceState); protected void onStart(); protected void onRestart();

protected void onResume(); protected void onPause(); protected void onStop(); protected void onDestroy();
Activity Life Cycle Android
Figure 4.3 The lifecycle of an Android Activity.

Now let's look at each of these callback methods, when they are called, and what they are used for.

Was this article helpful?

0 0
Easy Software Profits

Easy Software Profits

Here's How Anyone Can Start, Build and Run their Own Successful Software Empire Without Knowing the First Thing About Programming, Scripting Or Any 'Coder' Stuff. There is no doubt about it software sells. Software has a high percieved value and it solves problems for people.  A claim that can't always be made for PDF books, Video products and the like.

Get My Free Ebook

Post a comment