package com.hanpang.activitylife;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
System.out.println("创建");
}
@Override
protected void onStart() {
super.onStart();
System.out.println("开始");
}
@Override
protected void onStop() {
super.onStop();
}
@Override
protected void onDestroy() {
super.onDestroy();
System.out.println("销毁");
}
@Override
protected void onPause() {
super.onPause();
System.out.println("暂停");
}
@Override
protected void onResume() {
super.onResume();
System.out.println("运行");
}
@Override
protected void onRestart() {
super.onRestart();
System.out.println("重启");
}
}
运行过程演示.gif重写了上述的七个方法,我们进行测试
网友评论