- syntax:
<property android:name="string" android:resource="resource specification" android:value="string" />
- contained in:
<activity><activity-alias><application><provider><receiver><service>- description:
- A name-value pair for an item of additional, arbitrary data that can be supplied to the
parent component. A component element can contain any number of
<property>subelements. Valid names include any of the property constants defined in thePackageManagerclass,PackageManager.Propertytags defined in classes such asWindowProperties, and arbitrary constants defined ad hoc. Obtain values individually using thePackageManager.getProperty()method.Specify ordinary values with the
android:valueattribute. Specify resource IDs with theandroid:resourceattribute. Specifying bothandroid:valueandandroid:resourceis invalid.For example, the following code assigns whatever value is stored in the
@string/kangarooresource to thezooname:<property android:name="zoo" android:value=”@string/kangaroo” />
The code here, however, assigns the numeric ID of the resource, not the value stored in the resource, to
zoo:<property android:name="zoo" android:resource=”@string/kangaroo” />
- attributes:
android:name- The name of the property. A parsing error results if multiple, sibling
<property>tags have the same name. android:resource- A reference to a resource. The ID of the resource is the value assigned to the property. The ID can be retrieved
from the property by
PackageManager.Property.getResourceId(). android:value- A value assigned to the property. The following table lists valid data types and accessor methods for the value
attribute:
Type PackageManager.Property accessor String: Use double backslashes (\\) to escape characters; for example, \\nand\\uxxxxxfor a Unicode charactergetString()Integer: For example, 100getInteger()Boolean: Either trueorfalsegetBoolean()Color: In the form #rgb,#argb,#rrggbb, or#aarrggbbgetInteger()Float: For example, 1.23getFloat()
Note: A
<property>tag should not contain bothandroid:valueandandroid:resourceattributes. If that happens,android:resourceis preferred.- introduced in:
- API Level 31
<property>
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[]]