• <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 大龍 閱讀(395) 評論(0)  編輯 收藏 引用

            久久丫忘忧草产品| 色欲综合久久躁天天躁| 久久婷婷五月综合97色一本一本| 久久无码国产| 奇米综合四色77777久久| 久久亚洲国产成人精品性色| 久久精品一区二区| 亚洲精品无码专区久久同性男| 久久综合鬼色88久久精品综合自在自线噜噜 | 久久综合久久美利坚合众国| 久久99精品久久久久久久久久| 久久国产精品偷99| 久久本道伊人久久| 久久人人爽人人爽人人AV东京热| 精品久久久无码中文字幕| 久久99国产乱子伦精品免费| 一本色道久久88综合日韩精品 | 久久综合国产乱子伦精品免费| 久久久久久亚洲精品不卡| 女人香蕉久久**毛片精品| 91久久精一区二区三区大全| 亚洲国产一成人久久精品| 亚洲国产欧美国产综合久久| 久久婷婷午色综合夜啪| 久久大香萑太香蕉av| 欧美亚洲国产精品久久高清| 三级三级久久三级久久 | 91精品免费久久久久久久久| 人妻久久久一区二区三区| 91久久福利国产成人精品| 久久久久无码精品| 亚洲中文字幕久久精品无码APP| 欧美亚洲国产精品久久高清| 久久精品国产亚洲AV嫖农村妇女| 97精品依人久久久大香线蕉97| 亚洲国产精品无码久久久不卡| 91精品国产综合久久精品| 91麻豆国产精品91久久久| 精品久久久久久国产| 国内精品伊人久久久久777| 国产精品青草久久久久福利99|