Android Tutorial

(avery) #1
Android Tutorial 69

Some helpful methods in the android.util.Log class are shown in
Table.


To add logging support to MyFirstAndroidApp, edit the file MyFirst
AndroidApp. java. First, you must add the appropriate import
statement for the log class:


import android.util.Log;


Next, within the MyFirstAndroidApp class, declare a constant string
that you use to tag all logging messages from this class. You can
use the LogCat utility within Eclipse to filter your logging messages
to this debug tag:


private static final String DEBUG_TAG= “MyFirstAppLogging”;


Now, within the onCreate() method, you can log something
informational:

Free download pdf