Androidmanifest specific explanation of the application (a better understanding of the picture)

Source: Internet
Author: User

Tags that can be included:
    1. <activity>
    2. <activity-alias>
    3. <service>
    4. <receiver>
    5. <provider>
    6. <uses-library>

Frequently Used properties:

android:process

By default, Android creates a separate process for each application, and all components execute in that process, and the name of the default process is usually the same as the package name of the application. Example


<manifest xmlns:android= "http://schemas.android.com/apk/res/android"        package= "Com.lt.mytest" >
Then the program's default process name is Com.lt.mytest


Setting this property allows the application to share the same process with other applications, only if the two applications share a userid with the same signature.


<manifest xmlns:android= "http://schemas.android.com/apk/res/android"    android:shareduserid= " Android.uid.phone ">
The name of a Linux User ID that is shared with other applications.



By default, Android assigns a unique user Id to each application.

However. Assuming that more than one application sets the property to the same value, they will share the same ID.

Assuming that these applications are again set up to execute in the same process, they will be able to access each other's data.

Android:allowbackup
Whether the program is added to the system's backup and recovery architecture.

Android:taskaffinity
The attribution of activity, which is the task in which the activity should be, the adsorption relationship between activity and task. The default assumes that Taskaffinity is not set. Then the taskaffinity parking name is the same.
Taskaffinity and Flag_activity_new_task can be used to determine whether a new task needs to be created when the ACTIVITY starts.

Let's take a look at the impact of these two flags on activation activity in four scenarios: (Prerequisite: Start Activitya from Mainactivity)
1), two flags are not set
2), with Flag_activity_new_task
3), no flag_activity_new_task have taskaffinity (different from mainactivity)
4), there are Flag_activity_new_task have taskaffinity
Note that the above flags are for the Activitya to start. Flag_activity_new_task is set in the intent that starts Activitya, Taskaffinity is set in Androidmanifest in Activitya, Also note that the boot mode of the two actiity here is set to standard
1, first look at the first situation:

Main code:


<activity android:name= ". Activitya "    android:launchmode=" standard "  android:label=" @string/title_activitya ">      < intent-filter>      <action android:name= "Com.leaves.ipanel.ActivityA"/>      <category android:name= " Android.intent.category.DEFAULT "/>      </intent-filter>    </activity>  
Mainactivity Start activity
public void OnClick (View arg0) {  //TODO auto-generated method Stub  log.i (TAG, "--onclick--task id =" + getcurren Ttaskid ());  Intent Intent = new Intent ("Com.leaves.ipanel.ActivityA");      StartActivity (Intent);   
To start a stack after a:


2, there are flag_activity_new_task
We join Flag_activity_new_task


public void OnClick (View arg0) {  //TODO auto-generated method Stub  log.i (TAG, "--onclick--task id =" + getcurren Ttaskid ());  Intent Intent = new Intent ("Com.leaves.ipanel.ActivityA");      Intent.addflags (intent.flag_activity_new_task);  StartActivity (intent);   }  
To start a stack after a:


watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvymlny29udmllbmnl/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/center "/>

3, no flag_activity_new_task have taskaffinity (different from mainactivity)


<activity android:name= ". Activitya "                android:launchmode=" standard "              android:taskaffinity=" Com.leaves.test.ActivityA "            android: Label= "@string/title_activitya" >           <intent-filter>               <action android:name= " Com.leaves.ipanel.ActivityA "/>               <category android:name=" Android.intent.category.DEFAULT "/>           < /intent-filter>    
    public void OnClick (View arg0) {          //TODO auto-generated method Stub          log.i (TAG, "--onclick--task id =" + Getcurre Nttaskid ());          Intent Intent = new Intent ("Com.leaves.ipanel.ActivityA");                        StartActivity (intent);       }  
Take a look at the stack after starting a:



Androidmanifest specific explanation of the application (a better understanding of the figure)

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.