Chongye Wang
Chongye Wang

Reputation: 103

Equivalent method of System.out.println() rather than Log

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

Answers (2)

Firoz Memon
Firoz Memon

Reputation: 4650

LogCat is similar to console for displaying data.

For printing in LogCat:

  1. Use Log class (eg: Log.d(), Log.i(), etc..)

  2. Use System.out.println() this will print with TAG:System.out

  3. 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

alvaropanizo
alvaropanizo

Reputation: 177

You can use Timber library. Example:

Timber.d("Hello %s %s!", firstName);

Upvotes: 1

Related Questions