Print the value of a boolean in Log

前端 未结 2 1851
-上瘾入骨i
-上瘾入骨i 2021-02-12 21:07

Is it possible for me to print the Boolean value returned from a method in a Log message? I am able to print String values, but I am not sure how to print Boolean values in Log

相关标签:
2条回答
  • 2021-02-12 21:56

    Yes.

    Log.v("", "" + booleanValue);

    or

    Log.v("", Boolean.toString(booleanValue));
    0 讨论(0)
  • 2021-02-12 21:56

    I would do it like this:

    Log.d("SomeTag" , booleanValue?"true":"false");
    
    0 讨论(0)
提交回复
热议问题