O'Reilly logo

Mastering Android Studio 3 by Kyle Mew

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Logcat filters

One of the simplest, but nevertheless the most useful debugging, techniques is the simple inclusion of a Logcat filter. This can be used to report variable values or simply keep track of which methods are being called. This is of particular use when keeping track of processes that are not visibly apparent, such as services, broadcast receivers and callbacks that have no obvious impact on the UI. 

Perhaps the very simplest debug tool available, and useful when we are in a hurry and just want to check for a single value or event, is to include a line like:

System.out.println("Something happened here"); 

This is only an on the fly solution as the output will be buried in among the rest of the Logcat text. Far easier to manage ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required