Activity的生命周期
创建一个APP
在“MainActivity”中
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
System.out.println("onCreate");
}
@Override
protected void onStart() {
super.onStart();
System.out.println("onStart");
}
@Override
protected void onPause() {
super.onPause();
System.out.println("onPause");
}
@Override
protected void onResume() {
super.onResume();
System.out.println("onResume");
}
@Override
protected void onStop() {
super.onStop();
System.out.println("onStop");
}
@Override
protected void onDestroy() {
super.onDestroy();
System.out.println("onDestroy");
}
@Override
protected void onRestart() {
super.onRestart();
System.out.println("onRestart");
}
运行查看日记
标签:安卓开发