This is a first Android test!
验证Activity的生命周期
public class MainActivity extends AppCompatActivity {
public static final String TAG = "Lifecycle";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
protected void onStart() {
super.onStart();
Log.d(TAG,"onStart");
}
@Override
protected void onResume() {
super.onResume();
Log.d(TAG,"onResume");
} @Override
protected void onPause() {
super.onPause();
Log.d(TAG,"onPause");
}
@Override
protected void onStop() {
super.onStop();
Log.d(TAG,"onStop");
} @Override
protected void onDestroy() {
super.onDestroy();
Log.d(TAG,"onDestroy");
} @Override
protected void onRestart() {
super.onRestart();
Log.d(TAG,"onRestart");
}
}




