<meta-data android:name="string" android:resource="resource specification" android:value="string" />
<activity>
<activity-alias>
<service>
<receiver><meta-data> subelements. The values from all of
them are collected in a single Bundle object and made
available to the component as the
PackageItemInfo.metaData field.
Ordinary values are specified through the value
attribute. However, to assign a resource ID as the value, use the
resource attribute instead. For example,
the following code assigns whatever value is stored in the @string/kangaroo
resource to the "zoo" name:
<meta-data android:name="zoo" android:value="@string/kangaroo" />
On the other hand, using the resource attribute would assign "zoo"
the numeric ID of the resource, not the value stored in the resource:
<meta-data android:name="zoo" android:resource="@string/kangaroo" />
It is highly recommended that you avoid supplying related data as
multiple separate <meta-data> entries. Instead, if you
have complex data to associate with a component, store it as a resource and
use the resource attribute to inform the component of its ID.
android:namecom.example.project.activity.fred".android:resourceBundle.getInt() method.android:value| Type | Bundle method |
|---|---|
String value, using double backslashes (\\) to escape characters
— such as "\\n" and "\\uxxxxx" for a Unicode character. |
getString() |
Integer value, such as "100" |
getInt() |
Boolean value, either "true" or "false" |
getBoolean() |
Color value, in the form "#rgb", "#argb",
"#rrggbb", or "#aarrggbb" |
getString() |
Float value, such as "1.23" |
getFloat() |