|
楼主 |
发表于 2011-2-21 00:09:26
|
显示全部楼层
debug信息的显示
今天在看这个blog上的讲座,Java部分的基础知识恶补了一下,又在看Android编程。目前看第4章。http://android.yaohuiji.com/archives/141
关于一个Activity的生命周期。
例程如下:
- package com.Lesson4;
- import android.app.Activity;
- import android.os.Bundle;
- import android.util.Log;
- public class Lesson4 extends Activity {
- String tag = "[MainActivityLife]";
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- Log.i(tag, "onCreate");
- }
- @Override
- public void onPause(){
- super.onPause();
- Log.i(tag, "onPause");
- }
-
- @Override
- public void onResume(){
- super.onResume();
- Log.i(tag, "onResume");
- }
-
- @Override
- public void onStop(){
- super.onStop();
- Log.i(tag, "onStop");
- }
-
- @Override
- public void onDestroy(){
- super.onDestroy();
- Log.i(tag, "onDestroy");
- }
- }
复制代码
|
|