| java.lang.Object | ||||
| android.content.Context | ||||
| android.app.ApplicationContext | ViewInflate.Factory | |||
| android.app.Activity | KeyEvent.Callback Window.Callback | |||
An activity is a single, focused thing that the user can do. Almost all activities interact with the user, so the Activity class takes care of creating a window for you in which you can place your UI with setContentView(View). While activities are often presented to the user as full-screen windows, they can also be used in other ways: as floating windows (via a theme with windowIsFloating set) or embedded inside of another activity (using ActivityGroup). There are two methods almost all subclasses of Activity will implement:
To be of use with Context.startActivity(), all
activity classes must have a corresponding
<activity>
declaration in their package's AndroidManifest.xml.
The Activity class is an important part of an application's overall lifecycle.
Topics covered here:
Activities in the system are managed as an activity stack. When a new activity is started, it is placed on the top of the stack and becomes the running activity -- the previous activity always remains below it in the stack, and will not come to the foreground again until the new activity exits.
An activity has essentially four states:
The following diagram shows the important state paths of an Activity. The square rectangles represent callback methods you can implement to perform operations when the Activity moves between states. The colored ovals are major states the Activity can be in.

There are three key loops you may be interested in monitoring within your activity:
The entire lifecycle of an activity is defined by the following Activity methods. All of these are hooks that you can override to do appropriate work when the activity changes state. All activities will implement onCreate(Bundle) to do their initial setup; many will also implement onPause() to commit changes to data and otherwise prepare to stop interacting with the user. Currently many activities must also implement onFreeze() and perform the corresponding state recovery in onCreate(Bundle), though we plan to add more facilities in the system that take care of these for the application. Other methods may be implemented as needed. You should always call up to your superclass when implementing these methods.
public class Activity extends ApplicationContext {
protected void onCreate(Bundle icicle);
protected void onStart();
protected void onRestart();
protected void onResume();
protected void onFreeze(Bundle outIcicle);
protected void onPause();
protected void onStop();
protected void onDestroy();
}
In general the movement through an activity's lifecycle looks like this:
| Method | Description | Killable? | Next | ||
|---|---|---|---|---|---|
| onCreate() | Called when the activity is first created.
This is where you should do all of your normal static set up:
create views, bind data to lists, etc. This method also
provides you with a Bundle containing the activity's previously
frozen state, if there was one.
Followed by |
No | onResume() |
||
| onRestart() | Called after your activity has been stopped, prior to it being
started again.
Always followed by |
No | onResume() |
||
| onStart() | Called when the activity is becoming visible to the user.
Always followed by |
No | onRestart() or onResume() |
||
| onResume() | Called when the activity will start
interacting with the user. At this point your activity is at
the top of the activity stack, with user input going to it.
Followed by either |
No | onFreeze() oronPause() |
||
| 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.
Always followed by |
No | onPause() |
||
| onPause() | Called when the system is about to start resuming a previous
activity. This is typically used to commit unsaved changes to
persistent data, stop animations and other things that may be consuming
CPU, etc. Implementations of this method must be very quick because
the next activity will not be resumed until this method returns.
Followed by either |
Yes | onResume() oronStop() |
||
| onStop() | Called when the activity is no longer visible to the user, because
another activity has been resumed and is covering this one. This
may happen either because a new activity is being started, an existing
one is being brought in front of this one, or this one is being
destroyed.
Followed by either |
Yes | onStart() oronDestroy() |
||
| onDestroy() | The final call you receive before your activity is destroyed. This can happen either because the activity is finishing (someone called 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() method. | Yes | nothing | ||
Note the "Killable" column in the above table -- for those methods that
are marked as being killable, after that method returns the process hosting the
activity may killed by the system at any time without another line
of its code being executed. Thus you should take advantage of
onFreeze() (for saving your current UI state) and
onPause() (for writing any edits to persistent storage) so that
the activity will be correctly restored to its current state in the event that
it is killed. See the Process Lifecycle
section for more information on how the lifecycle of a process is tied
to the activities it is hosting.
For those methods that are not marked as being killable, the activity's
process will not be killed by the system starting from the time the method
is called and continuing after it returns. For example, an activity is in the killable
state at the moment of onPause(), up until the start of
onResume().
If the configuration of the device (as defined by the Resources.Configuration class) changes, then anything displaying a user interface will need to update to match that configuration. Because Activity is the primary mechanism for interacting with the user, it includes special support for handling configuration changes.
Unless you specify otherwise, a configuration change (such as a change in screen orientation, language, input devices, etc) will cause your current activity to be destroyed, going through the normal activity lifecycle process of onFreeze(Bundle), onPause(), onStop(), and onDestroy() as appropriate. If the activity had been in the foreground or visible to the user, once onDestroy() is called in that instance then a new instance of the activity will be created, with whatever icicle the previous instance had generated from onFreeze(Bundle).
This is done because any application resource, including layout files, can change based on any configuration value. Thus the only safe way to handle a configuration change is to re-retrieve all resources, including layouts, drawables, and strings. Because activities must already know how to save their state and re-create themselves from that state, this is a convenient way to have an activity restart itself with a new configuration.
In some special cases, you may want to bypass restarting your activity based on one or more types of configuration changes. This is done with the android:configChanges attribute in its manifest. For any type of configuration changes you say that you handle there, you will receive a call to your current activity's onConfigurationChanged(Resources.Configuration) method instead of being restarted. If a configuration change involves any that you do not handle, however, the activity will still be restarted and onConfigurationChanged(Resources.Configuration) will not be called.
The startActivity(Intent) method is used to start a new activity, which will be placed at the top of the activity stack. It takes a single argument, an Intent, which describes the activity to be executed.
Sometimes you want to get a result back from an activity when it ends. For example, you may start an activity that lets the user pick a person in a list of contacts; when it ends, it returns the person that was selected. To do this, you call the startSubActivity(Intent, int) version with a second integer parameter identifying the call. The result will come back through your onActivityResult(int, int, String, Bundle) method.
When an activity exits, it can call
setResult(int)
to return data back to its parent. It must always supply a result code,
which can be the standard results RESULT_CANCELED, RESULT_OK, or any
custom values starting at RESULT_FIRST_USER. In addition, it can optionally
return back a String (usually the URL of a piece of data), and a Bundle of any
additional values it would like. All of this information appears back on the
parent's Activity.onActivityResult(), along with the integer
identifier it originally supplied.
If a child activity fails for any reason (such as crashing), the parent activity will receive a result with the code RESULT_CANCELED.
Here's a sample of how to start a new activity and handle the result:
public class MyActivity extends Activity {
...
static final int PICK_CONTACT_REQUEST = 0;
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER) {
// When the user center presses, let them pick a contact.
startSubActivity(
new Intent(Intent.PICK_ACTION,
Uri.parse("content://contacts")),
PICK_CONTACT_REQUEST);
return true;
}
return false;
}
protected void onActivityResult(int requestCode, int resultCode,
String data, Bundle extras) {
if (requestCode == PICK_CONTACT_REQUEST) {
if (resultCode == RESULT_OK) {
// A contact was picked. Here we will just display it
// to the user.
startActivity(new Intent(Intent.VIEW_ACTION,
Uri.parse(data)));
}
}
}
}
onKeyDown() listens for a key press and starts the new
activity. onActivityResult() is called when the new activity
finishes.
There are generally two kinds of persistent state than an activity will deal with: shared document-like data (typically stored in a SQLite database using a content provider) and internal state such as user preferences.
For content provider data, we suggest that activities use an "edit in place" user model. That is, any edits a user makes are effectively made immediately without requiring an additional confirmation step. Supporting this model is generally a simple matter of following two rules:
When creating a new document, the backing database entry or file for it is created immediately. For example, if the user chooses to write a new e-mail, a new entry for that e-mail is created as soon as they start entering data, so that if they go to any other activity after that point this e-mail will now appear in the list of drafts.
When an activity's onPause() method is called, it should
commit to the backing content provider or file any changes the user
has made. This ensures that those changes will be seen by any other
activity that is about to run. You will probably want to commit
your data even more aggressively at key times during your
activity's lifecycle: for example before starting a new
activity, before finishing your own activity, when the user
switches between input fields, etc.
This model is designed to prevent data loss when a user is navigating between activities, and allows the system to safely kill an activity (because system resources are needed somewhere else) at any time after it has been paused. Note this implies that the user pressing BACK from your activity does not mean "cancel" -- it means to leave the activity with its current contents saved away. Cancelling edits in an activity must be provided through some other mechanism, such as an explicit "revert" or "undo" option.
See the content package for more information about content providers. These are a key aspect of how different activities invoke and propagate data between themselves.
The Activity class also provides an API for managing internal persistent state associated with an activity. This can be used, for example, to remember the user's preferred initial display in a calendar (day view or week view) or the user's default home page in a web browser.
Activity persistent state is managed with the method getPreferences(int), allowing you to retrieve and modify a set of name/value pairs associated with the activity. To use preferences that are shared across multiple application components (activities, receivers, services, providers), you can use the underlying Context.getSharedPreferences() method to retrieve a preferences object stored under a specific name. (Note that it is not possible to share settings data across application packages -- for that you will need a content provider.)
Here is an excerpt from a calendar activity that stores the user's preferred view mode in its persistent settings:
public class CalendarActivity extends Activity {
...
static final int DAY_VIEW_MODE = 0;
static final int WEEK_VIEW_MODE = 1;
private SharedPreferences mPrefs;
private int mCurViewMode;
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
SharedPreferences mPrefs = getPreferences(MODE_PRIVATE);
mCurViewMode = mPrefs.getInt("view_mode", DAY_VIEW_MODE);
}
protected void onPause() {
super.onPause();
SharedPreferences.Editor ed = mPrefs.edit();
ed.putInt("view_mode", mCurViewMode);
ed.commit();
}
}
The ability to start a particular Activity can be enforced when it is declared in its manifest's <activity> tag. By doing so, other applications will need to declare a corresponding <uses-permission> element in their own manifest to be able to start that activity.
See the Security Model document for more information on permissions and security in general.
The Android system attempts to keep application process around for as long as possible, but eventually will need to remove old processes when memory runs low. As described in Activity Lifecycle, the decision about which process to remove is intimately tied to the state of the user's interaction with it. In general, there are four states a process can be in based on the activities running in it, listed here in order of importance. The system will kill less important processes (the last ones) before it resorts to killing more important processes (the first ones).
The foreground activity (the activity at the top of the screen that the user is currently interacting with) is considered the most important. Its process will only be killed as a last resort, if it uses more memory than is available on the device. Generally at this point the device has reached a memory paging state, so this is required in order to keep the user interface responsive.
A visible activity (an activity that is visible to the user but not in the foreground, such as one sitting behind a foreground dialog) is considered extremely important and will not be killed unless that is required to keep the foreground activity running.
A background activity (an activity that is not visible to the user and has been paused) is no longer critical, so the system may safely kill its process to reclaim memory for other foreground or visible processes. If its process needs to be killed, when the user navigates back to the activity (making it visible on the screen again), its onCreate(Bundle) method will be called with the icicle it had previously supplied in onFreeze(Bundle) so that it can restart itself in the same state as the user last left it.
An empty process is one hosting no activities or other application components (such as Service or IntentReceiver classes). These are killed very quickly by the system as memory becomes low. For this reason, any background operation you do outside of an activity must be executed in the context of an activity IntentReceiver or Service to ensure that the system knows it needs to keep your process around.
Sometimes an Activity may need to do a long-running operation that exists independently of the activity lifecycle itself. An example may be a camera application that allows you to upload a picture to a web site. The upload may take a long time, and the application should allow the user to leave the application while it is executing. To accomplish this, your Activity should start a Service in which the upload takes place. This allows the system to properly prioritize your process (considering it to be more important than other non-visible applications) for the duration of the upload, independent of whether the original activity is paused, stopped, or finished.
Known Direct Subclasses
Known Indirect Subclasses| Value | ||||
|---|---|---|---|---|
| int | DIALER_DEFAULT_KEYS | Use with setDefaultKeyMode(int) to launch the dialer during default key handling. | 1 | 0x00000001 |
| int | DISABLE_DEFAULT_KEYS | Use with setDefaultKeyMode(int) to turn off default handling of keys. | 0 | 0x00000000 |
| int[] | FOCUSED_STATE_SET | |||
| int | RESULT_CANCELED | Standard activity result: operation canceled. | 0 | 0x00000000 |
| int | RESULT_FIRST_USER | Start of user-defined activity results. | 1 | 0x00000001 |
| int | RESULT_OK | Standard activity result: operation succeeded. | -1 | 0xffffffff |
| int | SEARCH_DEFAULT_KEYS | Use with setDefaultKeyMode(int) to specify that unhandled keystrokes will start a search. | 3 | 0x00000003 |
| int | SHORTCUT_DEFAULT_KEYS | Use with setDefaultKeyMode(int) to execute a menu shortcut in default key handling. | 2 | 0x00000002 |
Constants inherited
from class
android.content.Context
| Activity() |
| void | addContentView(View view, LayoutParams params) | ||||
| Add an additional content view to the activity. | |||||
| void | closeOptionsMenu() | ||||
| Closes the options menu. | |||||
| ActivityPendingResult | createActivityPendingResult(int requestCode, boolean multiple) | ||||
| Create a new ActivityPendingResult object, which you can hand to others for them to use to send result data back to your onActivityResult(int, int, String, Bundle) callback. | |||||
| boolean | dispatchKeyEvent(KeyEvent event) | ||||
| Called to process key events. | |||||
| boolean | dispatchTouchEvent(MotionEvent ev) | ||||
| Called to process touch screen events. | |||||
| boolean | dispatchTrackballEvent(MotionEvent ev) | ||||
| Called to process trackball events. | |||||
| View | findViewById(int id) | ||||
| Finds a view that was identified by the id attribute from the XML that was processed in onCreate(Bundle). | |||||
| void | finish() | ||||
| Call this when your activity is done and should be closed. | |||||
| void | finishSubActivity(int requestCode) | ||||
| Force finish another activity that you had previously started with startSubActivity(Intent, int). | |||||
| void | finishSubActivityFromChild(Activity child, int requestCode) | ||||
| This is called when a child activity of this one calls its finishSubActivity(). | |||||
| final | Application | getApplication() | |||
| Return the application that owns this activity. | |||||
| ComponentName | getCallingActivity() | ||||
| Return the name of the activity that invoked this activity. | |||||
| String | getCallingPackage() | ||||
| Return the name of the package that invoked this activity. | |||||
| ComponentName | getComponentName() | ||||
| Returns complete component name of this activity. | |||||
| View | getCurrentFocus() | ||||
| Calls getCurrentFocus() on the Window of this Activity to return the currently focused view. | |||||
| static | long | getInstanceCount() | |||
| Intent | getIntent() | ||||
| Return the intent that started this activity. | |||||
| String | getLocalClassName() | ||||
| Returns class name for this activity with the package prefix removed. | |||||
| final | Activity | getParent() | |||
| Return the parent activity if this view is embedded. | |||||
| SharedPreferences | getPreferences(int mode) | ||||
| Retrieve a SharedPreferences object for accessing preferences that are private to this activity. | |||||
| Object | getSystemService(String name) | ||||
| Return the handle to a system-level service by name. | |||||
| int | getTaskId() | ||||
| Return the identifier of the task this activity is in. | |||||
| final | CharSequence | getTitle() | |||
| final | int | getTitleColor() | |||
| ViewInflate | getViewInflate() | ||||
| Convenience for calling getViewInflate(). | |||||
| Window | getWindow() | ||||
| Retrieve the current Window for the activity. | |||||
| WindowManager | getWindowManager() | ||||
| Retrieve the window manager for showing custom windows. | |||||
| final | boolean | isEmbedded() | |||
| Is this activity embedded inside of another activity? | |||||
| boolean | isFinishing() | ||||
| Check to see whether this activity is in the process of finishing, either because you called finish() on it or someone else has requested that it finished. | |||||
| boolean | isTaskRoot() | ||||
| Return whether this activity is the root of a task. | |||||
| void | managedCommitUpdates(Cursor c) | ||||
| Wrapper around commitUpdates() that takes care of noting that the Cursor needs to be requeried. | |||||
| final | Cursor | managedQuery(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) | |||
| Wrapper around query(android.net.Uri, String[], String, String[], String) that gives the resulting Cursor to call startManagingCursor(Cursor) so that the activity will manage its lifecycle for you. | |||||
| boolean | moveTaskBackwards(boolean nonRoot) | ||||
| Move the task containing this activity backwards one level in the activity stack. | |||||
| boolean | moveTaskToBack(boolean nonRoot) | ||||
| Move the task containing this activity to the back of the activity stack. | |||||
| void | onContentChanged() | ||||
| This hook is called whenever the content view of the screen changes (due to a call to setContentView(). | |||||
| boolean | onContextItemSelected(Item item) | ||||
| This hook is called whenever an item in a context menu is selected. | |||||
| void | onContextMenuClosed(Menu menu) | ||||
| This hook is called whenever the context menu is being closed (either by the user canceling the menu with the back/menu button, or when an item is selected). | |||||
| CharSequence | onCreateDescription() | ||||
| Generate a new description for this activity. | |||||
| boolean | onCreateOptionsMenu(Menu menu) | ||||
| Initialize the contents of the Activity's standard options menu. | |||||
| boolean | onCreatePanelMenu(int featureId, Menu menu) | ||||
| Default implementation of onCreatePanelMenu(int, Menu) for activities. | |||||
| View | onCreatePanelView(int featureId) | ||||
| Default implementation of onCreatePanelView(int) for activities. | |||||
| boolean | onCreateThumbnail(Bitmap outBitmap, Canvas canvas) | ||||
| Generate a new thumbnail for this activity. | |||||
| boolean | onKeyDown(int keyCode, KeyEvent event) | ||||
| Called when a key was pressed down and not handled by any of the views inside of the activity. | |||||
| boolean | onKeyMultiple(int keyCode, int repeatCount, KeyEvent event) | ||||
| Default implementation of KeyEvent.Callback.onKeyMultiple(): always returns false (doesn't handle the event). | |||||
| boolean | onKeyUp(int keyCode, KeyEvent event) | ||||
| Called when a key was released and not handled by any of the views inside of the activity. | |||||
| boolean | onMenuItemSelected(int featureId, Item item) | ||||
| Default implementation of onMenuItemSelected(int, Menu.Item) for activities. | |||||
| boolean | onOptionsItemSelected(Item item) | ||||
| This hook is called whenever an item in your options menu is selected. | |||||
| void | onOptionsMenuClosed(Menu menu) | ||||
| This hook is called whenever the options menu is being closed (either by the user canceling the menu with the back/menu button, or when an item is selected). | |||||
| void | onPanelClosed(int featureId, Menu menu) | ||||
| Default implementation of onPanelClosed(int, Menu) for activities. | |||||
| boolean | onPrepareOptionsMenu(Menu menu) | ||||
| Prepare the Screen's standard options menu to be displayed. | |||||
| boolean | onPreparePanel(int featureId, View view, Menu menu) | ||||
| Default implementation of onPreparePanel(int, View, Menu) for activities. | |||||
| boolean | onSearchRequested() | ||||
| This hook is called when the user signals the desire to start a search. | |||||
| boolean | onTouchEvent(MotionEvent event) | ||||
| Called when a touch screen event was not handled by any of the views under it. | |||||
| boolean | onTrackballEvent(MotionEvent event) | ||||
| Called when the trackball was moved and not handled by any of the views inside of the activity. | |||||
| void | onWindowAttributesChanged(LayoutParams params) | ||||
| This is called whenever the current window attributes change. | |||||
| void | onWindowFocusChanged(boolean hasFocus) | ||||
| This hook is called whenever the window focus changes. | |||||
| void | openOptionsMenu() | ||||
| Opens the options menu. | |||||
| final | boolean | requestWindowFeature(int featureId) | |||
| Enable extended window features. | |||||
| final | void | runOnUIThread(Runnable action) | |||
| Runs the specified action on the UI thread. | |||||
| void | setContentView(int layoutResID) | ||||
| Set the activity content from a layout resource. | |||||
| void | setContentView(View view, LayoutParams params) | ||||
| Set the activity content to an explicit view. | |||||
| void | setContentView(View view) | ||||
| Set the activity content to an explicit view. | |||||
| final | void | setDefaultKeyMode(int mode) | |||
| Select the default key handling for this activity. | |||||
| final | void | setFeatureDrawable(int featureId, Drawable drawable) | |||
| Convenience for calling setFeatureDrawable(int, Drawable). | |||||
| final | void | setFeatureDrawableAlpha(int featureId, int alpha) | |||
| Convenience for calling setFeatureDrawableAlpha(int, int). | |||||
| final | void | setFeatureDrawableResource(int featureId, int resId) | |||
| Convenience for calling setFeatureDrawableResource(int, int). | |||||
| final | void | setFeatureDrawableUri(int featureId, Uri uri) | |||
| Convenience for calling setFeatureDrawableUri(int, Uri). | |||||
| void | setIntent(Intent newIntent) | ||||
| Change the intent returned by getIntent(). | |||||
| void | setPersistent(boolean isPersistent) | ||||
| Control whether this activity is required to be persistent. | |||||
| final | void | setProgress(int progress) | |||
| Sets the progress for the progress bars in the title. | |||||
| final | void | setProgressBarIndeterminate(boolean indeterminate) | |||
| Sets whether the horizontal progress bar in the title should be indeterminate (the circular is always indeterminate). | |||||
| final | void | setProgressBarVisibility(boolean visible) | |||
| Sets the visibility of the progress bars in the title. | |||||
| final | void | setResult(int resultCode, String data, Bundle extras) | |||
| Call this to set the result that your activity will return to its caller. | |||||
| final | void | setResult(int resultCode, String data) | |||
| Call this to set the result that your activity will return to its caller. | |||||
| final | void | setResult(int resultCode) | |||
| Call this to set the result that your activity will return to its caller. | |||||
| final | void | setSecondaryProgress(int secondaryProgress) | |||
| Sets the secondary progress for the progress bar in the title. | |||||
| void | setTitle(int titleId) | ||||
| Change the title associated with this activity. | |||||
| void | setTitle(CharSequence title) | ||||
| Change the title associated with this activity. | |||||
| void | setTitleColor(int textColor) | ||||
| void | startActivity(Intent intent) | ||||
| Launch a new activity. | |||||
| void | startActivityFromChild(Activity child, Intent intent, int requestCode) | ||||
| This is called when a child activity of this one calls its startActivity(Intent) or startSubActivity(Intent, int) method. | |||||
| void | startManagingCursor(Cursor c) | ||||
| This method allows the activity to take care of managing the given Cursor's lifecycle for you based on the activity's lifecycle. | |||||
| void | startSearch(String initialQuery, Bundle appSearchData) | ||||
| This hook is called to launch the search UI. | |||||
| void | startSubActivity(Intent intent, int requestCode) | ||||
| Launch a sub-activity. | |||||
| boolean | startSubActivityIfNeeded(Intent intent, int requestCode) | ||||
| A special variation to launch an activity only if a new activity instance is needed to handle the given Intent. | |||||
| void | stopManagingCursor(Cursor c) | ||||
| Given a Cursor that was previously given to startManagingCursor(Cursor), stop the activity's management of that cursor. | |||||
| void | takeKeyEvents(boolean get) | ||||
| Request that key events come to this activity. | |||||
| void | applyThemeResource(Theme theme, int resid, boolean first) | ||||
| Called by setTheme(int) and getTheme() to apply a theme resource to the current Theme object. | |||||
| void | finalize() | ||||
| Called by the virtual machine when there are no longer any (non-weak) references to the receiver. | |||||
| boolean | isFullscreenOpaque() | ||||
| Returns whether this activity's UI is full-screen and opaque. | |||||
| void | onActivityResult(int requestCode, int resultCode, String data, Bundle extras) | ||||
| Called when an activity you launched exits, giving you the requestCode you started it with, the resultCode it returned, and any additional data from it. | |||||
| void | onChildTitleChanged(Activity childActivity, CharSequence title) | ||||
| void | onCompleteThaw(Bundle state) | ||||
| This method is called after onStart() when the activity is being re-initialized from a previously saved state, given here in state. | |||||
| void | onConfigurationChanged(Configuration newConfig) | ||||
| Called by the system when the device configuration changes while your activity is running. | |||||
| void | onCreate(Bundle icicle) | ||||
| Called when the activity is starting. | |||||
| void | onDestroy() | ||||
| Perform any final cleanup before an activity is destroyed. | |||||
| void | onFreeze(Bundle outState) | ||||
| Called to retrieve the current dynamic user-interface state of the activity. | |||||
| void | onNewIntent(Intent intent) | ||||
| This is called for activities that set launchMode to "singleTop" in their package, or if a client used the | |||||