Android開發6:日誌信息輸出

Android開發
System.out.println();用這條語句是不能將信息打印到控制檯的。

需要用到Log
android.util.Log

windows ==> Preferences ==> Android ==> DDMS  ==> Logging Level

image 
設置日誌級別,選中之下的將被顯示,選中之上的不被顯示。

windows ==> Show View ==> Android ==> LogCat

image 
顯示LogCat欄目。

image

Summary

Constants

int
ASSERT
Priority constant for the println method.

int
DEBUG
Priority constant for the println method; use Log.d.

int
ERROR
Priority constant for the println method; use Log.e.

int
INFO
Priority constant for the println method; use Log.i.

int
VERBOSE
Priority constant for the println method; use Log.v.

int
WARN
Priority constant for the println method; use Log.w.

private static final String TAG = "MyActivity";

and use that in subsequent calls to the log methods.

Tip: Don't forget that when you make a call like

Log.v(TAG, "index=" + i);
學習交流>^<歡迎拍磚
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章