Android learning: LogCat log query

Source: Internet
Author: User

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


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.