Android-应用程序hasCode标记

Android-应用程序hasCode标记,android,Android,Android developer for包含标志hasCode。它的描述是: An application would not have any code of its own only if it's using nothing but built-in component classes, such as an activity that uses the AliasActivity class, a rare occurrence. 有人能给出一个他们谈论的AliasActivit

Android developer for
包含标志
hasCode
。它的描述是:

An application would not have any code of its own only if it's using 
nothing but built-in component classes, such as an activity that uses 
the AliasActivity class, a rare occurrence.

有人能给出一个他们谈论的AliasActivity用例的代码示例吗(很少出现)?

一个AliasActivity,顾名思义,只是另一个活动的别名

您可以仅在XML中创建一个。Android git存储库中有一个

您可以如下所示:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.android.aliasactivity">
    <application android:hasCode="false" android:label="@string/app_label">
        <activity android:name="android.app.AliasActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
            <meta-data android:name="android.app.alias"
                    android:resource="@xml/alias" />
        </activity>
    </application>
</manifest>

在res/xml/alias.xml中定义意图:

<alias xmlns:android="http://schemas.android.com/apk/res/android">
    <intent android:action="android.intent.action.VIEW"
        android:data="http://www.google.com/">
    </intent>
</alias>