Reputation: 103
What I want to do is to print a 2d array to the console, so the Log.d might not be convenient for that.
What are some other methods that work similar to system.out.println() in Android Studio?
Upvotes: 2
Views: 340
Reputation: 4650
LogCat
is similar to console for displaying data.
For printing in LogCat
:
Use Log
class (eg: Log.d(), Log.i(), etc..)
Use System.out.println()
this will print with TAG:System.out
Use 3rd party libraries like Timber
or Logger
But all of this will help you to display, 1 item at a time; not the whole 2d Array.
For displaying a 2d array, you have to create a custom
logging utility method which displays it dynamically.
Upvotes: 2
Reputation: 177
You can use Timber library. Example:
Timber.d("Hello %s %s!", firstName);
Upvotes: 1