For existing Java users, coding Android using the Eclipse IDE will surprise many first timers. Why? Because the System.out.println() does not show anything in the console. But do not fret, there is a way and it is just not in the console.

There is another console called LogCat and this is what you need to enable in order for you to view console output. Go to Windows > Show View > Android > (Other) > LogCat.

Then you use the Log class in order to send out messages to the LogCat console. The Log class has actually a few methods to distinguish what kind of message it sends out to the console. Check them out below.

To use the Log class, do this. It takes in two parameters: TAG is useful to indicate where the message originated.

The screenshot below came from these two lines of code

Notice that I was still able to output using System.out.println() but the the Log class is much more useful for me because it is easier for me to dissect which class the output came from.

Related Posts Plugin for WordPress, Blogger...