java完成盤算地輿坐標之間的間隔。本站提示廣大學習愛好者:(java完成盤算地輿坐標之間的間隔)文章只能為提供參考,不一定能成為您想要的結果。以下是java完成盤算地輿坐標之間的間隔正文
本文實例講述了Android編程之基於Log演示一個activity性命周期。分享給年夜家供年夜家參考,詳細以下:
應用Android的Log 演示一個activity的性命周期
代碼:
//DemoActivity.java package uni.activity; /* @author octobershiner 2011 7 22 SE.HIT */ import android.app.Activity; import android.os.Bundle; import android.util.Log; public class ActivityDemoActivity extends Activity { /** Called when the activity is first created. */ private static final String TAG = "demo"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Log.d("demo", "this is a test string "); } protected void onStart(){ super.onStart(); Log.i(TAG, "The activity state---->onStart"); } protected void onRestart(){ super.onRestart(); Log.i(TAG, "The activity state---->onReatart"); } protected void onResume(){ super.onResume(); Log.i(TAG, "The activity state---->onResume"); } protected void onPause(){ super.onPause(); Log.i(TAG, "The activity state---->onPause"); } protected void onStop(){ super.onStop(); Log.i(TAG, "The activity state---->onStop"); } protected void onDestroy(){ super.onDestroy(); Log.i(TAG, "The activity state---->onDestroy"); } }
這是演示的成果
應用LOG展現activity的性命周期
正文表現 中央履行的操作 為便利的不雅察數據,可以在LOGCAT窗口(沒有的話可以在window菜單中的show view中調出)的右邊單擊加號創立一個過濾器,我的例子中過濾的是demo
//開端運轉demo 07-22 11:18:19.311: INFO/demo(281): The activity state---->onStart 07-22 11:18:19.311: INFO/demo(281): The activity state---->onResume //按下了back鍵 前往 activity從stack中彈出 07-22 11:18:34.821: INFO/demo(281): The activity state---->onPause 07-22 11:18:35.090: INFO/demo(281): The activity state---->onStop 07-22 11:18:35.090: INFO/demo(281): The activity state---->onDestroy //再次啟動demo 07-22 11:18:45.550: INFO/demo(281): The activity state---->onStart 07-22 11:18:45.550: INFO/demo(281): The activity state---->onResume //按下了HOME鍵 以後TASK 處於後台轉態,體系保留狀況 07-22 11:18:53.750: INFO/demo(281): The activity state---->onPause 07-22 11:18:54.820: INFO/demo(281): The activity state---->onStop //再次啟動demo 答復本來的TASK activity在棧頂 07-22 11:19:03.550: INFO/demo(281): The activity state---->onReatart 07-22 11:19:03.550: INFO/demo(281): The activity state---->onStart 07-22 11:19:03.550: INFO/demo(281): The activity state---->onResume
別的過濾檢查log的辦法:
實例
Log.i("yourDemo","this is my log");
沒有LOGCAT窗口的同伙可以在window菜單中的show view中調出窗口
五個圓圈分離可以過濾五種分歧的log
留意左邊的綠色加號,單擊可以自界說本身的過濾器,名字隨意起就行了
by Log Tag欄目中 選擇你要創立的過濾規矩,好比你要過濾出所遇TAG標志為“yourDemo”的log,便可以在外面輸出yourDemo了
願望本文所述對年夜家Android法式設計有所贊助。
elta);以上就是本文的全體內容了,願望年夜家可以或許愛好。