开发者

Eclipse IDE, viewing variables in the terminal when developing Android Applications

I am developing my android applications with the Eclipse IDE. It occoured to me on occasions I would like to check the state of a variable. For instance when I recieve some data over a socket connection and store it in a String variable I would like to be able to check that what is being sent is correc开发者_StackOverflow社区t.

I have read that the System.out.println(myvariable);and log.d(myvairable) should write the request to the android log which can be accessed via Window - Show View - Logcat. However this does not appear to be the case for me. (I can view the log, however nothing is appearing)

So my question is, what is the appropriate way to display a variable in the terminal (equivalent) when developing android applications in the Eclipse IDE.

Thankyou in advance.


The appropriate way is Log.d("YourApplicationName", "YourMessage"). This will write a debug message to the console. You can also write an error message with Log.e, a warning message with Log.w, an info message with Log.i and a verbose message with Log.v.

If you do not see it in Eclipse, this is perhaps because the default verbosity do not display debug messages. Look if there is an option to change this or use adb logcat in a terminal.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜