Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Activity and its life cycle in Android?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 458
    Comment on it

    An activity represents a single screen with user interface(UI) i.e.,a window with which you interact with your android phone. It is a pre-defined class in Android and every android application which has a UI must inherit it to create a window.Using activity you can place all your UI components or widgets in a single screen.

    Life cycle of an activity::
    There are total 7 life-cycle methods that a activity can go through. They are:

    1. onCreate(): This method is called when the activity is first created.
    2. onStart(): This method is called when the activity is visible to user.
    3. onResume: This method is called when the user starts interacting with the activity.
    4. onPause(): This method is called when the current activity is not visible to user i.e. a new activity has come to foreground and the current activity is sent to pause mode. The paused activity is unable to receive any input from the user and does not execute any code.
    5. onStop(): This method is called when the activity is no longer to visible to user.
    6. onRestart(): This method is called when the activity restarts after stopping it.
    7. onDestroy(): This method is called before the activity is destroyed or terminated by system .


    alt text

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: