• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            大龍的博客

            常用鏈接

            統計

            最新評論

            Android Activity的生命周期

            1. 啟動Activity:onCreate()->onStart()->onResume()->Activity is running

            2. 按back鍵返回:onPause()->onStop()->onDestroy() 再次啟動時:onCreate()->onStart()->onResume()->Activity is running

            3.按home鍵返回:onPause()->onStop() 再次啟動時:onRestart()->onStart()->onResume()->Activity is running

            4.切換到別的Activity(當前Activity不finish): onPause()->onStop() 再次啟動時:onCreate()->onStart()->onResume()->Activity is running


            5.切換到別的Activity(當前Activity finish): onPause()->onStop()->onDestroy() 再次啟動時:onCreate()->onStart()->onResume()->Activity is running



            package com.Aina.Android;
            
            import android.app.Activity;
            import android.content.Intent;
            import android.os.Bundle;
            import android.util.Log;
            import android.view.View;
            import android.widget.Button;
            
            public class Test_CeShi extends Activity {
            	/** Called when the activity is first created. */
            	private int i = 1;
            	private Button btn;
            	/**
            	 * 創建
            	 */
            	@Override
            	public void onCreate(Bundle savedInstanceState) {
            		Log.i("TAG-onCreate", "onCreate()------------" + (i++));
            		super.onCreate(savedInstanceState);
            		setContentView(R.layout.main);
            		btn = (Button) this.findViewById(R.id.Button01);
            		btn.setOnClickListener(new Button.OnClickListener(){
            
            			@Override
            			public void onClick(View v) {
            				Intent intent = new Intent(Test_CeShi.this,fg.class);
            				Test_CeShi.this.startActivity(intent);
            //				Test_CeShi.this.finish();
            			}
            			
            		});
            	}
            
            	/**
            	 * 重新開始
            	 */
            	@Override
            	protected void onRestart() {
            		Log.i("TAG-onRestart", "onRestart()------------" + (i++));
            		super.onRestart();
            	}
            
            	/**
            	 * 啟動
            	 */
            	@Override
            	protected void onStart() {
            		Log.i("TAG-onStart", "onStart()------------" + (i++));
            
            		super.onStart();
            	}
            
            	/**
            	 * 重新啟動
            	 */
            	@Override
            	protected void onResume() {
            		Log.i("TAG-onResume", "onResume()------------" + (i++));
            		super.onResume();
            	}
            
            	/**
            	 * 暫停
            	 */
            	@Override
            	protected void onPause() {
            		Log.i("TAG-onPause", "onPause()------------" + (i++));
            
            		super.onPause();
            	}
            
            	/**
            	 * 停止
            	 */
            	@Override
            	protected void onStop() {
            		Log.i("TAG-onStop", "onStop()------------" + (i++));
            		super.onStop();
            	}
            
            	/**
            	 * 銷毀
            	 */
            	@Override
            	protected void onDestroy() {
            		Log.i("TAG-onDestroy", "onDestroy()------------" + (i++));
            		super.onDestroy();
            	}
            
            }

            posted on 2011-01-16 15:21 大龍 閱讀(397) 評論(0)  編輯 收藏 引用

            久久久久亚洲AV片无码下载蜜桃| 国产亚州精品女人久久久久久 | 久久精品国产99国产精偷| 亚洲AV日韩AV天堂久久| 国产精品美女久久久久| 精品久久久久久无码国产| 亚洲一级Av无码毛片久久精品| 亚洲午夜无码AV毛片久久| 国产产无码乱码精品久久鸭| 久久久久亚洲AV无码专区桃色 | 94久久国产乱子伦精品免费| 中文字幕无码久久精品青草| 国产精品一区二区久久国产| 久久午夜无码鲁丝片午夜精品| 久久综合九色综合网站| 久久午夜无码鲁丝片午夜精品| 久久综合给久久狠狠97色| 久久精品国产精品亚洲人人 | 久久精品中文无码资源站| 97精品伊人久久久大香线蕉| 2020久久精品亚洲热综合一本| 久久精品国产亚洲一区二区| 久久精品aⅴ无码中文字字幕不卡 久久精品成人欧美大片 | 久久婷婷五月综合国产尤物app| 久久久久99精品成人片欧美| 久久免费视频1| 亚洲欧美另类日本久久国产真实乱对白 | 久久久久久久久久久精品尤物| 国内精品久久久久久久涩爱 | 国产精品久久久天天影视香蕉 | 久久国产色AV免费观看| 久久久久青草线蕉综合超碰| 中文字幕无码久久精品青草| 亚洲精品99久久久久中文字幕| 国产L精品国产亚洲区久久| 青青青青久久精品国产h| Xx性欧美肥妇精品久久久久久| 久久国产亚洲精品麻豆| 亚洲嫩草影院久久精品| 国产精品美女久久久久AV福利| 久久福利青草精品资源站免费|