Home | History | Annotate | Download | only in manifest
      1 page.title=<activity-alias>
      2 parent.title=The AndroidManifest.xml File
      3 parent.link=manifest-intro.html
      4 @jd:body
      5 
      6 <dl class="xml">
      7 <dt>syntax:</dt>
      8 <dd><pre class="stx">&lt;activity-alias android:<a href="#enabled">enabled</a>=["true" | "false"]
      9                 android:<a href="#exported">exported</a>=["true" | "false"]
     10                 android:<a href="#icon">icon</a>="<i>drawable resource</i>"
     11                 android:<a href="#label">label</a>="<i>string resource</i>"
     12                 android:<a href="#nm">name</a>="<i>string</i>"
     13                 android:<a href="#prmsn">permission</a>="<i>string</i>"
     14                 android:<a href="#trgt">targetActivity</a>="<i>string</i>" &gt;
     15     . . .
     16 &lt;/activity-alias&gt;</pre></dd>
     17 
     18 <dt>contained in:</dt>
     19 <dd><code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code></dd>
     20 
     21 <dt>can contain:</dt>
     22 <dd><code><a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">&lt;intent-filter&gt;</a></code>
     23 <br/><code><a href="{@docRoot}guide/topics/manifest/meta-data-element.html">&lt;meta-data&gt;</a></code></dd>
     24 
     25 <dt>description:</dt>
     26 <dd>An alias for an activity, named by the {@code targetActivity} 
     27 attribute.  The target must be in the same application as the
     28 alias and it must be declared before the alias in the manifest.
     29 
     30 <p>
     31 The alias presents the target activity as a independent entity.
     32 It can have its own set of intent filters, and they, rather than the 
     33 intent filters on the target activity itself, determine which intents 
     34 can activate the target through the alias and how the system
     35 treats the alias.  For example, the intent filters on the alias may 
     36 specify the "<code>{@link android.content.Intent#ACTION_MAIN 
     37 android.intent.action.MAIN}</code>" 
     38 and "<code>{@link android.content.Intent#CATEGORY_LAUNCHER 
     39 android.intent.category.LAUNCHER}</code>" flags, causing it to be 
     40 represented in the application launcher, even though none of the 
     41 filters on the target activity itself set these flags.
     42 </p>
     43 
     44 <p>
     45 With the exception of {@code targetActivity}, {@code &lt;activity-alias&gt;} 
     46 attributes are a subset of <code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code> attributes.  
     47 For attributes in the subset, none of the values set for the target carry over
     48 to the alias.  However, for attributes not in the subset, the values set for 
     49 the target activity also apply to the alias.
     50 </p></dd>
     51 
     52 <dt>attributes:</dt>
     53 <dd><dl class="attr">
     54 <dt><a name="enabled"></a>{@code android:enabled}</dt>
     55 <dd>Whether or not the target activity can be instantiated by the system through 
     56 this alias &mdash; "{@code true}" if it can be, and "{@code false}" if not.  
     57 The default value is "{@code true}".
     58 
     59 <p>
     60 The <code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code> element has its own 
     61 <code><a href="{@docRoot}guide/topics/manifest/application-element.html#enabled">enabled</a></code> attribute that applies to all 
     62 application components, including activity aliases.  The 
     63 <code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code> and {@code &lt;activity-alias&gt;} 
     64 attributes must both be "{@code true}" for the system to be able to instantiate 
     65 the target activity through the alias.  If either is "{@code false}", the alias 
     66 does not work.
     67 </p></dd>
     68 
     69 <dt><a name="exported"></a>{@code android:exported}</dt>
     70 <dd>Whether or not components of other applications can launch the target activity 
     71 through this alias &mdash; "{@code true}" if they can, and "{@code false}" if not.  
     72 If "{@code false}", the target activity can be launched through the alias only by 
     73 components of the same application as the alias or applications with the same user ID.  
     74 
     75 <p>
     76 The default value depends on whether the alias contains intent filters.  The 
     77 absence of any filters means that the activity can be invoked through the alias
     78 only by specifying the exact name of the alias.  This implies that the alias 
     79 is intended only for application-internal use (since others would not know its name)  
     80 &mdash; so the default value is "{@code false}".
     81 On the other hand, the presence of at least one filter implies that the alias 
     82 is intended for external use &mdash; so the default value is "{@code true}".
     83 </p></dd>
     84 
     85 <dt><a name="icon"></a>{@code android:icon}</dt>
     86 <dd>An icon for the target activity when presented to users through the alias.  
     87 See the <code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code> element's 
     88 <code><a href="{@docRoot}guide/topics/manifest/activity-element.html#icon">icon</a></code> attribute for more information.
     89 
     90 <dt><a name="label"></a>{@code android:label}</dt>
     91 <dd>A user-readable label for the alias when presented to users through the alias.
     92 See the <code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code> element's
     93 <code><a href="{@docRoot}guide/topics/manifest/activity-element.html#label">label</a></code> attribute for more information.
     94 </p></dd>
     95 
     96 <dt><a name="nm">{@code android:name}</dt>
     97 <dd>A unique name for the alias.  The name should resemble a fully
     98 qualified class name.  But, unlike the name of the target activity, 
     99 the alias name is arbitrary; it does not refer to an actual class.  
    100 </p></dd>
    101 
    102 <dt><a name="prmsn"></a>{@code android:permission}</dt>
    103 <dd>The name of a permission that clients must have to launch the target activity 
    104 or get it to do something via the alias.  If a caller of 
    105 <code>{@link android.content.Context#startActivity startActivity()}</code> or
    106 <code>{@link android.app.Activity#startActivityForResult startActivityForResult()}</code>
    107 has not been granted the specified permission, the target activity will not be
    108 activated. 
    109 
    110 <p>This attribute supplants any permission set for the target activity itself.  If
    111 it is not set, a permission is not needed to activate the target through the alias.
    112 </p>
    113 
    114 <p>
    115 For more information on permissions, see the 
    116 <a href="{@docRoot}guide/topics/manifest/manifest-intro.html#perms">Permissions</a> 
    117 section in the introduction.
    118 </p></dd>
    119 
    120 <dt><a name="trgt"></a>{@code android:targetActivity}</dt>
    121 <dd>The name of the activity that can be activated through the alias.
    122 This name must match the {@code name} attribute of an 
    123 <code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code> element that precedes
    124 the alias in the manifest.
    125 </p></dd>
    126 </dl></dd>
    127 
    128 <!-- ##api level indication## -->
    129 <dt>introduced in:</dt>
    130 <dd>API Level 1</dd>
    131 
    132 <dt>see also:</dt>
    133 <dd><code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code></dd>
    134 
    135 </dl>
    136