Android Learning-the third day

Source: Internet
Author: User

Learning content: Activity life cycle and Logcat use

====activity life cycle = = = =

Illustrated (reproduced):

Normally starting an activity to terminate the operation, the main function call process is as follows:

OnCreate

OnStart

Onresume

OnPause

OnStop

OnDestroy

If you encounter a program running, suddenly have high priority other programs need to run, such as pressed the home button, called the following:

OnPause

OnStop

This is called when the application is restored:

OnStart

Onresume

If the phone supports screen rotation, the activity destroys and then re-creates the activity instance after rotation!

If the primary layout file is Xxx.xml, then Xxx-land.xml is the default layout file for widescreen

Activity has the ability to save state information at run time, and the call point function is onsaveinstancestate, which can be within the function

Save any state information you want to a bundle object and wait until the next run, the OnCreate function will provide you

Bundle object, you can take out the status information you want!

====logcat Use = =

Logcat is a component of the Development IDE tool, which is designed to view various log information and to easily filter logs to focus on important log information.

The IDE opens the Logcat process without a breath, if you need to view the log output, if the program needs to log logs, Android provides a log class: Android.util.Log.

Log class Common method Description:

When using it, first define a tag name, indicating which category the log belongs to, Logcat used to select a specific tag, or filter tag keywords; Common methods are as follows:

LOG.E (..) Error message

LOG.W (..) Warning message

LOG.I (..) General Information

LOG.D (..) Debugging information

LOG.V (..) Developers commonly used, development output verbose log

Android Learning-the third day

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.