Execution Of Different Method Of Activited in Android LifeCycle
package com.lifeCycle;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;
public class LifeCycleActivity extends Activity implements OnClickListener
{
Button b1;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
b1=(Button)findViewById(R.id.button1);
b1.setOnClickListener(this);
}
@Override
protected void onDestroy()
{
// TODO Auto-generated method stub
super.onDestroy();
Toast.makeText(this, "onDestroy method called",1000).show();
}
@Override
protected void onPause() {
// TODO Auto-generated method stub
Toast.makeText(this, "onPause() method called",1000).show();
super.onPause();
}
@Override
protected void onPostResume() {
// TODO Auto-generated method stub
Toast.makeText(this, "onPostResume() method called",1000).show();
super.onPostResume();
}
@Override
protected void onRestart() {
// TODO Auto-generated method stub
Toast.makeText(this, "onRestart() method called",1000).show();
super.onRestart();
}
@Override
protected void onResume() {
// TODO Auto-generated method stub
Toast.makeText(this, "onResume() method called",1000).show();
super.onResume();
}
@Override
protected void onStart() {
// TODO Auto-generated method stub
Toast.makeText(this, "onStart() method called",1000).show();
super.onStart();
}
@Override
protected void onStop() {
// TODO Auto-generated method stub
Toast.makeText(this, "onStop() method called",1000).show();
super.onStop();
}
public void onClick(View v) {
Toast.makeText(this, "onStop() method called",1000).show();
this.finish();
}
}
Comments
Post a Comment