开发者

Print the value of a boolean in Log

开发者 https://www.devze.com 2023-03-13 14:31 出处:网络
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 valu开发者_StackOverflowes in Log mes

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 valu开发者_StackOverflowes in Log message.


Yes.

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

or

Log.v("", Boolean.toString(booleanValue));


I would do it like this:

Log.d("SomeTag" , booleanValue?"true":"false");
0

精彩评论

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

关注公众号