Android activity-alias Guide
The activity-alias attribute is used in the AndroidManifest.xml file to specify an alias for an existing activity component. It can be used in various situations such as:
- Change the attributes of an existing activity: Use activity-alias to modify the properties of an existing activity, such as changing the label, icon, or theme of the activity.
Original: Je suis vraiment désolé pour ce malentendu.
Paraphrase: I sincerely apologize for this misunderstanding.
<activity-alias
android:name=".MainActivityAlias"
android:targetActivity=".MainActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
- Create an alias for an activity: Using activity-aliases allows you to create a nickname for an existing activity, allowing components using that nickname to access the activity.
He is always complaining about his job.
He constantly gripes about his job.
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity-alias
android:name=".MainActivityAlias"
android:targetActivity=".MainActivity" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
</intent-filter>
</activity-alias>
In the example above, when an HTTP link is opened through a browser, the system will match to MainActivityAlias and start MainActivity.
It is important to note that an activity-alias is simply an alias and not an actual activity component. It does not have its own lifecycle and cannot receive its own Intent. It acts as a delegate, forwarding intents to the targetActivity specified activity component.