zoukankan      html  css  js  c++  java
  • Activity LifeCycle (安卓应用的运行机制)

    测试回调代码

    package com.example.hello;
    
    import androidx.appcompat.app.AppCompatActivity;
    
    import android.os.Bundle;
    import android.util.Log;
    
    public class MainActivity extends AppCompatActivity {
        String TAG="myTag";
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            Log.d(TAG,  "on Create:");
        }
        @Override
        protected void onStart(){
            super.onStart();
            Log.d(TAG,"on Start:");
        }
        @Override
        protected void onResume(){
            super.onResume();
            Log.d(TAG,"on Resume:");
        }
    
        @Override
        protected void onResumeFragments() {
            super.onResumeFragments();
        }
    
        @Override
        protected void onPause() {
            super.onPause();
            Log.d(TAG,"on Pause:");
        }
    
        @Override
        protected void onStop() {
            super.onStop();
            Log.d(TAG,"on Stop:");
        }
    
        @Override
        protected void onRestart() {
            super.onRestart();
            Log.d(TAG,"on Restart:");
        }
    
        @Override
        protected void onDestroy() {
            super.onDestroy();
            Log.d(TAG,"on Destroy:");
        }
    }
    MainActivity

    测试结果

  • 相关阅读:
    English trip V1
    English trip M1
    every day a practice —— morning(5)
    English Voice of <<All Of Me>>
    bzoj 3561 DZY Loves Math VI
    luogu P4322 [JSOI2016]最佳团体
    luogu P3264 [JLOI2015]管道连接
    bzoj 5084 hashit
    luogu P6091 原根
    bzoj 5206 [Jsoi2017]原力
  • 原文地址:https://www.cnblogs.com/deepend/p/12243708.html
Copyright © 2011-2022 走看看