«

»

Sep 23

Android Activity Life Cycle Demo

I’m just starting with Android, and if you are a beginner like me, you probably want to understand two of main concepts of Android: Activities and Intents. You probably start off with a “Hello, World.”, so in Android that is an Activity. Anything you can see on the screen is handled by an Activity. And Intents are what is used to start other activities (and services). To understand an Activity’s behavior when triggered by Intents and user interactions, it is very important to properly understand the life cycle of an Activity. That is what I’m trying to do. You can find a good description of the life cycle here, but it was a little difficult to find an example code. I finally found in lecture slides of Victor Matos of Cleveland State University here. Below I have put the code, with some parts commented out so that I can easily understand the bare bone stuff. This is just a single Activity, next I’ll try to demo this behavior with two Activities using Intents.



7 comments

Skip to comment form

  1. neeraj

    Good Explanation, i was searching some thing like this

  2. Parmendra Singh

    Really nice explanation of activity cycle for the starters….

  3. srikanth

    Really very nice . it is very easy to understand
    thanks a lot

  4. Vaibhav Muley

    Very very best tutorial. Very good to understand activity life cycle. Change your emulator orientation to get method onRestoreInstanceState(Bundle savedInstanceState) be called.

  5. saurabh

    nice one and yes androidians rock

  6. Sunil Khunger

    I like that your way to description of the activity life cycle.

  7. Ananth.V

    good explatnation for activity
    life cycle

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>