System.out.println in android?

前端 未结 3 501
有刺的猬
有刺的猬 2021-01-28 01:14

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

相关标签:
3条回答
  • 2021-01-28 02:02

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

    0 讨论(0)
  • 2021-01-28 02:10

    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:

    Configure LogCat Header Dialog

    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.

    0 讨论(0)
  • 2021-01-28 02:16

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

    0 讨论(0)
提交回复
热议问题