标签:etc 生命周期 rri nbsp out extends color instance ons
public class MainActivity extends Activity {
private String tag = "MainActivity";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Log.i(tag, "onCreat"); //Activity被系统实例化之后触发
}
@Override
protected void onStart() {
super.onStart();
Log.i(tag, "onStart()"); //onCreat或onRestart方法之后触发
}
@Override
protected void onResume() {
super.onResume();
Log.i(tag, "onResume()"); //onStart之后触发
}
@Override
protected void onPause() {
super.onPause();
Log.i(tag, "onStart()"); //使Activity处于暂停状态时触发
}
@Override
protected void onStop() {
super.onStop();
Log.i(tag, "onStop()"); //Activity处于停止状态时触发
}
@Override
protected void onRestart() {
super.onRestart();
Log.i(tag, "onRestart"); //从停止状态转变为运行状态时触发
}
@Override
protected void onDestroy() {
super.onDestroy();
Log.i(tag, "onDestroy()"); //使Activity处于系统回收时触发
}
}
如有不足,欢迎指出。
标签:etc 生命周期 rri nbsp out extends color instance ons
原文地址:http://www.cnblogs.com/WINTER-KING/p/5989808.html