Learn Android for Free,issues for developers, mobengineers website provide complete solutions for developers issues posts.It also provides online training for android development

Monday, September 3, 2012

Activity Life Cycle

Activities in the life cycle are managed as an activity stack. When a new activity is started, it is placed on the top of the stack.  It becomes the running activity.
The previous activity always remains below it in the stack, and will not come to the foreground until the new activity exits.
4       Stages of Activity:
1.       If an activity in the foreground of the screen (at the top of the stack), it is active or running.
  1. If an activity has lost focus but is still visible, it is paused. It saves the activity state, but can be killed by the system in extreme low memory situations.
  2. If an activity is completely occupied by another activity, it is stopped. It  retains all state and member information.
  3. If an activity is paused or stopped, the system can drop the activity from memory by either asking it to finish or simply killing the process.

Public class MainActivity extends Activity {
Public void onCreate(Bundle savedInstanceState) {
Protected void onStart() {
// The activity is about to become visible.
Protected void onResume(){
// the activity has become visible
Protected void onPause(){
// Another activity is taking focus
Protected void onStop(){
//the activity is no longer visible
Protected void onDestroy(){
//the activity is about to be destroyed
The entire lifetime of an activity happends between the call to onCreate() and call to onDestroy().

0 coment�rios:

Post a Comment

20% off

Online Training

Your Name :
Your Email: (required)
Your Message: (required)

NDTV Gadgets360

Powered by Blogger.

Recent Posts

Find Us On Facebook

Popular Posts