An application can have multiple application

Source: Internet
Author: User
Tags home screen

Han Mengfei sha yue31313 Han Yafei Han_meng_fei_sha [email protected]

How can I have 2 application in an app? A Androidmanifest.xml can define multiple application

Can there be 2 application in an application?

===========

What is an activity Stack?

As mentioned above, activity undertakes a great deal of display and interaction, and from a certain point of view, the application we see is a combination of many activities. In order for the many activities to work together without confusion, the Android platform has designed a stack mechanism for managing activity, which follows the principle of advanced, always showing activity at the top of the stack, logically, It is also logical that activity at the top of the stack is the last activity that is opened.

When the application is operational, each time a new activity is started, it is pressed into the activity stack, and when the user performs a return operation, the activity on top of the activity stack is removed, thus enabling the function to return to the previous activty. Until the user has returned to home screen, it is understood that the activity stack no longer exists and the application ends up running, removing all activity from the activity stack.

What is a task?

Task refers to the combination of related activity, managed in the same way as the activity stack. From the user experience, an "application" is a task, but fundamentally, a task can be made up of one or more Android application. For example, if you want to send an SMS message, take a photo and send it as an MMS, you first stay on the acitivity of the SMS application, and then jump to the activity of the camera app, and then return to the activity of the SMS app when the camera function is complete. This is actually the work done by two Android application in collaboration, but for a better user experience, the Android platform joins the task mechanism so that users do not feel the interruption of the application, allowing the user to feel that they have done what they want in an "application".

======

What is an Activity Stack?
When operating an application, it is sometimes necessary to invoke multiple activities to complete the requirements, such as sending a mail program, first entering the mail main interface, and then initiating a new activity to fill in the new message content, as well as to bring up the contact list for inserting recipient information, and so on. During this operation, the Android platform has a mechanism dedicated to managing the activities stack, which can easily log activities instances in a linear way, and when an operation is completed, the previous activity can be returned via the navigation function (by pressing the "Back" button).
Each time a new activity is started, it is added to the activity Stack. Users can easily return to the previous activity until home screen, after reaching home screen, will no longer be able to continue to view the stack record (as the saying goes: Head). If the current task is aborted (interrupting the task), another operation is initiated after returning to the system main interface, and when you want to return to the previous task to continue execution, you only need to pass through the main interface again application Launcher or a shortcut initiates the task's root activity to return to its aborted state for execution.
Activity is the only data that can be recorded in the history stack relative to views, Windows, menus, and dialogs, so when you design an application that requires the user to go to sub-level interface B from the A interface, you need to return a after the operation is complete. Then you must consider a as Activity, otherwise you will not be able to return from the history stack.
What is a task
When we need one activity to start another activity, maybe another activity is defined as activity in different applications.
For example, suppose you want to let the user show a few places of Street View in your app. And there's an activity here that can do this, so all you need to do is add the necessary information to the intent object and pass it to StartActivity (). A map tour will show your map. When the user presses the back key, your activity will reappear on the screen.
For the user, it looks as if a map view is the same as your activity and belongs to the same application, even if it is defined in another application and runs in the process of that application.
Android embodies this user experience by keeping the two activity in the same task. Simply put, a task is an "app" on the user experience.
It combines the related activity and manages it as a stack (the activity stack mentioned earlier), which is the task.
On the Android platform, task can be simply understood as a multi-activity to work together to complete an application, regardless of the activity specific to which application,

What's the use of Task?
We have used Android phones to know the following scenario:
Let's say we are using ireader in reading, from choosing books to the Reading interface of specific books, there are several activity. Each of our clicked activity is placed in the activity stack that reads this task, which allows us to return each previous activity with the fallback key.
When we read halfway, we wanted to see Sina Weibo and press the home button to leave the Ireader.
There are also several activity in the Sina microblogging interface, we step to the reading interface. Each of our clicked activity is placed in the activity stack of the Sina Weibo task, which allows us to return each previous activity with the fallback key.
We return to the Ireader reading interface, the original state is still retained.
It is clear that each task has its own Activity Stack.
The task is set up to make it easier for people to use the phone, as mentioned in the previous scenario task can span application.
The following diagram depicts the relationship of the application Task activities from a different perspective

The task is started by Application Launcher, a shortcut to home screen, or a task record that has been recently used by recent tasks (long time hold home key).
When another activity is started from one activity, the back key is used to return the previous activity, while the newly opened activity is added to the activity stack.

=========

An app can have more than one application

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.