Mobile Application Develpment: Android Activities
Mobile Application Develpment: Android Activities
Develpment
Android Activities
Activity Definition
An activity represents a single screen with
a user interface (Java file + xml layout file).
6
Some Activity Methods
onCreate():
is called when an Activity is getting created for the first time.
onStart():
used onStart to reset Activity data, reinitialize variables etc.
onResume():
gets called when an Activity comes into the foreground, and it becomes
visible to the user. At this point, the user can start interacting with the Activity.
onPause():
is called when another android activity comes on top of an Activity.
onStop():
is called when an Activity is no longer visible to the user, it is similar to
onPause but here you will not see your android activity entirely.
onRestart():
It is similar to onCreate, but onRestart gets called only after onStop.
OnDestroy:
This is the method which will be called when your Activity is getting killed.
This is the final call the Activity will receive in its Lifecycle.
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.
The previous activity will not come to the foreground again until the
new activity exits. (“Back stack”)
Navigation forward/back triggered by user actions
Three different life cycles of an
activity
The entire lifetime
Starts by first call to onCreate(Bundle) and
Getting Started
https://developer.android.com/training/index.html