Create a new Android App and place this in the main activity.
Then view the LogCat window (under Android's DDMS) for the outputs
Build you application the same − add all the onPause, onStop, etc. methods with outputs to the LogCat.
As your program runs you can monitor what is called and at what times.
package com.app.myapp;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
public class MyApp extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
LinearLayout layout = new LinearLayout(this);
Button exit = new Button(this);
exit.setText("finish");
exit.setOnClickListener(new Button.OnClickListener()
{
public void onClick(View v)
{
// TODO Auto-generated method stub
Log.v("MyApp", "finish");
finish();
}
});
layout.addView(exit);
setContentView(layout);
Log.v("MyApp", "onCreate");
}
@Override
protected void onDestroy()
{
// TODO Auto-generated method stub
super.onDestroy();
Log.v("MyApp", "onDestroy");
}
@Override
protected void onPause()
{
// TODO Auto-generated method stub
super.onPause();
Log.v("MyApp", "onPause");
}
@Override
protected void onRestart()
{
// TODO Auto-generated method stub
super.onRestart();
Log.v("MyApp", "onRestart");
}
@Override
protected void onResume()
{
// TODO Auto-generated method stub
super.onResume();
Log.v("MyApp", "onResume");
}
@Override
protected void onStart()
{
// TODO Auto-generated method stub
super.onStart();
Log.v("MyApp", "onStart");
}
@Override
protected void onStop()
{
// TODO Auto-generated method stub
super.onStop();
Log.v("MyApp", "onStop");
}
}