zoukankan      html  css  js  c++  java
  • Activity的生命周期

    import java.util.ArrayList;
    
    import android.app.Activity;
    import android.content.Context;
    import android.content.Intent;
    import android.os.Bundle;
    import android.support.v4.view.PagerAdapter;
    import android.support.v4.view.ViewPager;
    import android.util.Log;
    import android.view.View;
    import android.view.View.OnClickListener;
    import android.view.ViewGroup;
    import android.view.Window;
    import android.widget.Button;
    import android.widget.ImageView;
    
    public class MainActivity extends Activity {
        ViewPager mViewPager;
    
        protected void onCreate(Bundle savedInstanceState) {
            requestWindowFeature(Window.FEATURE_NO_TITLE);
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            mViewPager = (ViewPager) findViewById(R.id.vp);
            PagerAdapter mPagerAdapter = new myAdapter(this);
            mViewPager.setAdapter(mPagerAdapter);
            Log.e("MainActivity", "=========开始创建");
            Button button = (Button) findViewById(R.id.btn);
            button.setOnClickListener(new OnClickListener() {
    
                @Override
                public void onClick(View v) {
                    Intent intent = new Intent(MainActivity.this, ActivityB.class);
                    startActivity(intent);
                }
            });
        }
    
        @Override
        protected void onPause() {
            super.onPause();
            Log.e("MainActivity", "=============暂停");
        }
    
        protected void onDestroy() {
            Log.e("MainActivity", "=============完全退出");
            super.onDestroy();
        }
    
        @Override
        protected void onRestart() {
            Log.e("MainActivity", "=============重新开始");
            super.onRestart();
        }
    
        @Override
        protected void onResume() {
            Log.e("MainActivity", "=============正在运行");
            super.onResume();
        }
    
        @Override
        protected void onStart() {
            Log.e("MainActivity", "=============开启");
            super.onStart();
        }
    
        @Override
        protected void onStop() {
            Log.e("MainActivity", "=============结束");
            super.onStop();
        }
  • 相关阅读:
    Some Depth Theory
    Hom和$otimes$如何把我绕晕
    A natrual way to introduce homotopy groups
    指数多项式的Galois群计算
    Trianglated Category and Derived Categories
    最近的代数课上的一些灵魂提问
    致青年朋友的一封信 莫洛亚
    一个函数证明题
    游客的故事
    14. 运算符重载(二)
  • 原文地址:https://www.cnblogs.com/labixiaoxin/p/4933599.html
Copyright © 2011-2022 走看看