System.out.println in android?

此生再无相见时 提交于 2019-12-02 22:39:17

问题


Is there any way that I can view my print statements in android studio without displaying the time and directory? It's extremely distracting and hard to debug when that text is taking up so much space.


回答1:


In the Android Monitor view in Android Studio (tested on Version 1.3), in the vertical toolbar inside the "logcat" tab, you will find a gear-shaped toolbar button. Click that, and you will get a "Configure LogCat Header" dialog with checkboxes to allow you to toggle on and off various pieces of what gets displayed:

Uncheck the items that you do not want (e.g., "Show time"). Note that LogCat does not show any "directory" except with respect to something you log yourself. My guess is that by "directory" you are referring to the package name.

This does not appear to affect existing messages, but should affect any future ones appended to the LogCat transcript.




回答2:


You should use Log.d(tag, message). See here for the documentation.




回答3:


try to use Log.d("message to show in log console")



来源:https://stackoverflow.com/questions/33393673/system-out-println-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!