You can debug in Android by applying android.util.Log.
開發程式時,Debug的訊息是很有幫助的!
在Android中,你可以透過 android.util.Log 來Debug!
package com.test;
import android.app.Activity; import android.os.Bundle; import android.util.Log; public class hello extends Activity { /** Called when the activity is first created. */ private static final String TAG = "DEBUG"; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main);
for(int i=0;i<5;i++){ Log.v(TAG, "i:"+i); }
|
How to see log? LogCat
如何看Debug Message? 使用LogCat
Window >>
Show View >>
Others
選擇
LogCat
訊息出現在LogCat視窗,i=0......

You can click the green icon + to filter log by tag you define in code.And then it's easier to see log.
這麼多Log要怎麼看?你可以點綠+的部分,將剛程式中你所定義的
private static final String TAG = "DEBUG"來加到Filter,如此一來便可方便地只看到自己定義的Log。
沒有留言:
張貼留言