(Android review) Task Stack and startup mode, androidreview

Source: Internet
Author: User

(Android review) Task Stack and startup mode, androidreview



This knowledge point is mainly understood as follows:

I. task stack)

1. function: it is used to manage the activity entry and exit. Records user behaviors.

2. Example:

Perform the following operations:


At this time, the activity in the task stack is as follows:





Ii. Startup Mode

1. Configuration:

For example:

<Activity
XXXX
Android: configChanges = "orientation | keyboardHidden">


2. Category:

Standard: Click an activity to create an activity.


SingleTop: if the activity to be started is already on the top of the stack, no new activity will be created.


SingleTask: if the activity to be started is already in the task stack, it will find the activity and
All the above activities are cleared and then reused.


SingleInstance: This activity occupies a separate job stack. When you start such an activity
The reference of this activity will cut off the previous reference


3. Example:


Note: Use A to represent MainActivity, and use B to represent Main2Activity.

1) if you perform operations A ----> B --->,

In this case, the result in the job stack corresponding to standard and singleTop is:




2) if A ------> B --------> A ------> B,

The job stacks corresponding to singleTask and singleInstance are as follows:













Android solves a startup mode problem

The Android Activity has a moveTaskToBack () method. Its function is to place the application in the background and run the Activity stack.
If you press the return key to call finish () by default, you can call the corresponding method in the Activity as needed.

Android startup Modes

1. general start mode (normal mode) to enter the method: press the power button to start Description: this is the normal method to start the phone 2. safe mode: press the menu key and press the power key to start the phone until the phone is started. Release the menu key. Description: it is the same as normal startup, but Google is not registered, therefore, you cannot access the Market or use your Google account. boot mode: press the camera key and press the power key to start the phone. Description: you can install a new system image (DREAIMG) on the SD card. NBH), just press the power button again. This mode is used to downgrade the mobile phone to obtain the root permission. 4. restore mode: press the HOME Key and press the power key to start the mobile phone Description: You can open the command interpreter (shell), refresh the image file (flash image), and execute backup. Of course, it all depends on the recovery image version on your mobile phone. 5. diagnostic mode: press the trackball and press the power key to start the phone Description: For testing (press the volume key to select a project) 6. fastboot mode Entry Method: Press and hold the return key, press the power key to start the phone, until the FASTBOOT text appears on the screen, then release the return key

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.