Download this Blogger Template by Clicking Here!

Ad 468 X 60



Tuesday, December 06, 2011


Activity In Android :

What is an Activity ?
  • User interface of an application displayed on a device through an activity.
  • For each unique screen we have to create an activity.
  • When we run any application on our device(android smartphones, mobile devices or tablet pc) and moving one screen to another screen then there is a bunch of activities works internally.
  • There will be create a stack(called as backstack) and performing push-pop action with activities. When new activity creates , it pushed into backstack and poped from it by pressing "Back" button.
  • When we want to create a new activity , we have to extend the "Activity" class.

Source Code of an Activity :

import android.os.Bundle;
public class MyFirstActivity extends Activity 
  /** Called when the activity is first created. */
  public void onCreate(Bundle savedInstanceState) 

Life Cycle of an Activity :

You can easily understand the life cycle of an activity by this figure :

Note :- Adding dashed lines for <<kill>> , those indicate that OS may kill the activity when resources are low, so onStop() and/or onDestroy() might not be called.


  • Facebook
  • Twitter
  • Myspace
  • Google Buzz
  • Reddit
  • Stumnleupon
  • Delicious
  • Digg
  • Technorati
Author: Mohammad
Mohammad is the founder of STC Network which offers Web Services and Online Business Solutions to clients around the globe. Read More →