Android learning: LogCat log query
I. Log Tool
After an android Application is running, it does not output any information in the ide console. But the Log class provided by android.
Output logs in the program, using the android. util. Log class.
This class provides several static methods
Log. v (String tag, String msg );
Log. d (String tag, String msg );
Log. I (String tag, String msg );
Log. w (String tag, String msg );
Log. e (String tag, String msg );
Corresponding to Verbose, Debug, Info, Warning, Error.
A tag is an identifier and can be any string. Generally, you can use the class name + method name to provide a filter condition when viewing logs.
2. logging in the program
Public void test (View view) {Log. I ("test", "Enter test function"); // findViewByIdTextView textView = (TextView) findViewById (R. id. textView1); textView. setText (R. string. textChange); // ToastToast toast = Toast. makeText (MainActivity. this, "click Button", Toast. LENGTH_SHORT); // The center of the screen. The offset between the X axis and the Y axis is 0 toast. setGravity (Gravity. CENTER, 0, 0); toast. show ();}
Iii. LogCat