TShopping

 找回密碼
 註冊
搜索
TShopping 精選文章 Android 手機開發 查看內容

[Android智慧型手機設計_Activity生命週期]

2013-7-10 19:58| 發佈者: woff| 查看: 715| 評論: 0|原作者: woff

摘要: package com.example.activitylife; //匯入類別庫 import android.os.Bundle; import android.app.Activity; import android.util.Log; import android.view.Menu; public class ActivityLife extends Activity { ...
 
ActivityLife.jpg


  1. package com.example.activitylife;
  2. //匯入類別庫

  3. import android.os.Bundle;
  4. import android.app.Activity;
  5. import android.util.Log;
  6. import android.view.Menu;

  7. public class ActivityLife extends Activity {
  8. String name="ch6-2_ActivityLife";
  9. @Override
  10. protected void onCreate(Bundle savedInstanceState) {
  11. super.onCreate(savedInstanceState);
  12. setContentView(R.layout.main);
  13. //紀錄偵錯訊息
  14. Log.d(name, "ch6-2_ActivityLife:onCreat()");
  15. }

  16. @Override
  17. protected void onStart() {
  18. super.onStart();
  19. Log.d(name, "ch6-2_ActivityLife:onStart()");
  20. }




  21. @Override
  22. protected void onResume() {
  23. super.onResume();
  24. Log.d(name, "ch6-2_ActivityLife:onResume()");
  25. }

  26. @Override
  27. protected void onPause() {
  28. super.onPause();
  29. Log.d(name, "ch6-2_ActivityLife:onPause()");
  30. }

  31. @Override
  32. protected void onStop() {
  33. super.onStop();
  34. Log.d(name, "ch6-2_ActivityLife:onStop()");
  35. }

  36. @Override
  37. protected void onRestart() {
  38. super.onRestart();
  39. Log.d(name, "ch6-2_ActivityLife:onRestart()");
  40. }

  41. @Override
  42. protected void onDestroy() {
  43. super.onDestroy();
  44. Log.d(name, "ch6-2_ActivityLife:onDestory()");
  45. }

  46. }
復制代碼

最新評論



Archiver|手機版|小黑屋|免責聲明|TShopping

GMT+8, 2017-9-24 21:03 , Processed in 0.040713 second(s), 21 queries .

本論壇言論純屬發表者個人意見,與 TShopping綜合論壇 立場無關 如有意見侵犯了您的權益 請寫信聯絡我們。

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

返回頂部