Android Activity life cycle

Source: Internet
Author: User

The website life cycle chart is as follows:

A more common scenario is described below:

Two activity, a A and a B, these two activity all replicate the declaration cycle method and output the a/b+ life cycle function name in the method. A has a button to start B.

Scenario 1:

A starts with the button B in a:

A onCreate, a onStart, a onresume, a onPause , b onCreate, b onStart, b onresume-&G T A onStop -B ...

That is, when a starts B, when the A OnPause method executes, all of the initialization methods of B are executed, and a onstop executes after these methods of B are completed.

Scenario 2:

Case 1 is a condition in which B is opaque, a is not visible, then the same operation, if B is transparent such as in the form of a dialog box, and does not completely cover a, it is:

A onCreate, a onStart, a onresume, a onPause , b onCreate, b onStart b onStop- > B ondestory-a onresume , b onresume

In other words, when B is closed, b OnPause is performed first and then A is restored, because a does not stop, so the direct resume, the last B onStop, b Destroy.

Android Activity life cycle

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.