Life Cycle of Activity – Flow of Android Application


Android Application has a unique and very easy workflow what does it mean that , whenever a developer develops a android application. He has to follow the work Flow of android application.Whenever we extend Activity in our Java file it imports class

How Activity of an android application transit between one Activity to another Activity.Lets explore –

As we can see the below diagram according to  , Activity life cyle has 7 main methods in which our Activity is transit within.

lifecycle of activity

Let’s take a glance of Activity life cycle and understand how it works- Simple definition and implementations-

1) . onCreate() –  This method calls whenever Activity is first created. This is First method invoked in which we do our coding like setContentView(R.layout.activity_main).

import android.os.Bundle;  
import android.content.DialogInterface;  
import android.view.Menu;  
public class MainActivity extends Activity {  
    protected void onCreate(Bundle savedInstanceState) {  

2). onStart() – This method is called when Activity is becoming visible to user and eventually user is able to see the App , as you can see the Activity image above . onCreate immediately calls onStart().

3). onResume() – This method is invoked after onStart() method , It called whenever activity is interacting with the users continuously .

4). onPause() – This method is invoked whenever Activity goes in Pause state like during music if call comes then music player goes in pause state.

5). onStop() – This method is invoked when Activity is no longer interacting with the user.

6). onRestart() – This Activity invoked whenever after Activity is stopped and priority is to start.

7). onDestroy() – This methods invoked whenever our Activity is destroyed .User exit the Application.

According to official website of android i.e example of Activitylife cycle  .This source code you can download

Download code

Output –






for more query and suggestions do post here :p Happy coding folks!


4 thoughts on “Life Cycle of Activity – Flow of Android Application

Leave a Reply

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