How to output messages to the Eclipse console when developing for Android

后端 未结 5 2021
花落未央
花落未央 2020-12-22 20:05

How can I print messages (like a flag) to the Eclipse console (or log) when developing and debugging an Android app

5条回答
  •  -上瘾入骨i
    2020-12-22 21:12

    System.out.println() also outputs to LogCat. The benefit of using good old System.out.println() is that you can print an object like System.out.println(object) to the console if you need to check if a variable is initialized or not.

    Log.d, Log.v, Log.w etc methods only allow you to print strings to the console and not objects. To circumvent this (if you desire), you must use String.format.

提交回复
热议问题