Sixth life cycle of Android apps

Source: Internet
Author: User

========================= Sixth Chapter =========================
The life cycle of an application:

The main factors that determine the life cycle of an Android system include:

1. How much memory is currently available on the system-when memory is low, kill some processes to free up memory

2. The importance of the process to the user--priority to kill processes that are not important to the user

1. Foreground process---run in the foreground, can interact directly with the user process

2. Visible process---User visible, temporarily obscured, temporarily unable to interact with the user process

3. Service process---the process in the background started the service

4. Background process---to not start the service, just click the Home button, keep the process in the background

5. Empty process-----The user clicks the return key and exits the process

Processes that are kept in memory are divided into the above process types. The degree of importance decreases in turn. When the system memory is low, the priority is to kill the empty process.

Life cycle of activity:

7 Events---------------7 methods-------------------four states

Create---------------onCreate ()------------< creating the activity>

Start----------------OnStart ()--------------< start the activity>

Resume---------------onresume ()-----------Enter the active state

Restart--------------Onrestart ()------------< restart the activity>

Pause----------------OnPause ()------------into a paused state

Stop-----------------onStop ()-------------Enter the stopped state

Destory--------------ondestory ()----------End state

Use the log class to print:

LOG.V (String tag,string text);------Verbose level
LOG.D (String tag,string text);------Debug Level
LOG.I (String tag,string text);------Info level
LOG.W (String tag,string text);------Warn level
LOG.E (String tag,string text);------Error Level

Only log logs below a certain level can be filtered.

Sixth life cycle of Android apps

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.