Output an object to the Logcat console
You cannot print an object to the console in Java as you would in javascript.
You have three solutions.
1) Use debugger. Place a breakpoint and debug in android studio. Then you can inspect the full object in scope.
2) Serialize your object (for example to JSON) and print the result to console.
3) Override toString
method of your object to give you all the information you want and call Log.d("myTag", yourObj.toString())
I highly recommend first method. I used to avoid Debugger but learning how to use the debugger was the best thing I did. It increases your efficiency and makes debugging super easy
The second argument must be a String.
Log.d("an_id", String.valueOf(the_arg));
Your error says you can't log a View
class
no suitable method found for d(String,View)
Don't be surprised when you see some nonsense in the console when you print that View
object through using String.valueOf