java.lang.Object | ||
↳ | android.content.res.Resources | |
↳ | android.test.mock.MockResources |
A mock Resources class. All methods are non-functional and throw UnsupportedOperationException. Override it to provide the operations that you need.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Return an XmlResourceParser through which you can read an animation
description for the given resource ID.
| |||||||||||
Return a color integer associated with a particular resource ID.
| |||||||||||
Return a color state list associated with a particular resource ID.
| |||||||||||
Return the current configuration that is in effect for this resource
object.
| |||||||||||
Retrieve a dimensional for a particular resource ID.
| |||||||||||
Retrieve a dimensional for a particular resource ID for use
as an offset in raw pixels.
| |||||||||||
Retrieve a dimensional for a particular resource ID for use
as a size in raw pixels.
| |||||||||||
Return the current display metrics that are in effect for this resource
object.
| |||||||||||
Return a drawable object associated with a particular resource ID.
| |||||||||||
Return a resource identifier for the given resource name.
| |||||||||||
Return the int array associated with a particular resource ID.
| |||||||||||
Return an integer associated with a particular resource ID.
| |||||||||||
Return an XmlResourceParser through which you can read a view layout
description for the given resource ID.
| |||||||||||
Return a movie object associated with the particular resource ID.
| |||||||||||
Return the string value associated with a particular resource ID for a particular
numerical quantity, substituting the format arguments as defined in
Formatter and format(String, Object...). It will be
stripped of any styled text information.
| |||||||||||
Return the string value associated with a particular resource ID for a particular
numerical quantity.
| |||||||||||
Return the entry name for a given resource identifier.
| |||||||||||
Return the full name for a given resource identifier.
| |||||||||||
Return the package name for a given resource identifier.
| |||||||||||
Return the type name for a given resource identifier.
| |||||||||||
Return the string value associated with a particular resource ID,
substituting the format arguments as defined in Formatter
and format(String, Object...). It will be stripped of any styled text
information.
| |||||||||||
Return the string value associated with a particular resource ID. It
will be stripped of any styled text information.
| |||||||||||
Return the string array associated with a particular resource ID.
| |||||||||||
Return the string value associated with a particular resource ID.
| |||||||||||
Return the string value associated with a particular resource ID. The
returned object will be a String if this is a plain string; it will be
some other type of CharSequence if it is styled.
| |||||||||||
Return the styled text array associated with a particular resource ID.
| |||||||||||
Return the raw data associated with a particular resource ID.
| |||||||||||
Return the raw data associated with a particular resource ID.
| |||||||||||
Return an XmlResourceParser through which you can read a generic XML
resource for the given resource ID.
| |||||||||||
Retrieve a set of basic attribute values from an AttributeSet, not
performing styling of them using a theme and/or style resources.
| |||||||||||
Return an array of heterogeneous values.
| |||||||||||
Open a data stream for reading a raw resource.
| |||||||||||
Open a file descriptor for reading a raw resource.
| |||||||||||
Store the newly updated configuration.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class android.content.res.Resources
| |||||||||||
From class java.lang.Object
|
Return an XmlResourceParser through which you can read an animation description for the given resource ID. This parser has limited functionality -- in particular, you can't change its input, and only the high-level events are available.
This function is really a simple wrapper for calling getXml(int) with an animation resource.
id | The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier. |
---|
Resources.NotFoundException |
---|
Return a color integer associated with a particular resource ID. If the resource holds a complex ColorStateList, then the default color from the set is returned.
id | The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier. |
---|
Resources.NotFoundException |
---|
Return a color state list associated with a particular resource ID. The resource may contain either a single raw color value, or a complex ColorStateList holding multiple possible colors.
id | The desired resource identifier of a ColorStateList, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier. |
---|
Resources.NotFoundException |
---|
Return the current configuration that is in effect for this resource object. The returned object should be treated as read-only.
Retrieve a dimensional for a particular resource ID. Unit conversions are based on the current DisplayMetrics associated with the resources.
id | The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier. |
---|
Resources.NotFoundException |
---|
Retrieve a dimensional for a particular resource ID for use as an offset in raw pixels. This is the same as getDimension(int), except the returned value is converted to integer pixels for you. An offset conversion involves simply truncating the base value to an integer.
id | The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier. |
---|
Resources.NotFoundException |
---|
Retrieve a dimensional for a particular resource ID for use as a size in raw pixels. This is the same as getDimension(int), except the returned value is converted to integer pixels for use as a size. A size conversion involves rounding the base value, and ensuring that a non-zero base value is at least one pixel in size.
id | The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier. |
---|
Resources.NotFoundException |
---|
Return the current display metrics that are in effect for this resource object. The returned object should be treated as read-only.
Return a drawable object associated with a particular resource ID. Various types of objects will be returned depending on the underlying resource -- for example, a solid color, PNG image, scalable image, etc. The Drawable API hides these implementation details.
id | The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier. |
---|
Resources.NotFoundException |
---|
Return a resource identifier for the given resource name. A fully qualified resource name is of the form "package:type/entry". The first two components (package and type) are optional if defType and defPackage, respectively, are specified here.
Note: use of this function is discouraged. It is much more efficient to retrieve resources by identifier than by name.
name | The name of the desired resource. |
---|---|
defType | Optional default resource type to find, if "type/" is not included in the name. Can be null to require an explicit type. |
defPackage | Optional default package to find, if "package:" is not included in the name. Can be null to require an explicit package. |
Return the int array associated with a particular resource ID.
id | The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier. |
---|
Resources.NotFoundException |
---|
Return an integer associated with a particular resource ID.
id | The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier. |
---|
Resources.NotFoundException |
---|
Return an XmlResourceParser through which you can read a view layout description for the given resource ID. This parser has limited functionality -- in particular, you can't change its input, and only the high-level events are available.
This function is really a simple wrapper for calling getXml(int) with a layout resource.
id | The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier. |
---|
Resources.NotFoundException |
---|
Return a movie object associated with the particular resource ID.
id | The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier. |
---|
Resources.NotFoundException |
---|
Return the string value associated with a particular resource ID for a particular numerical quantity, substituting the format arguments as defined in Formatter and format(String, Object...). It will be stripped of any styled text information.
id | The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier. |
---|---|
quantity | The number used to get the correct string for the current language's plural rules. |
formatArgs | The format arguments that will be used for substitution. |
Resources.NotFoundException |
---|
Return the string value associated with a particular resource ID for a particular numerical quantity.
id | The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier. |
---|---|
quantity | The number used to get the correct string for the current language's plural rules. |
Resources.NotFoundException |
---|
id | The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier. |
---|
Resources.NotFoundException |
---|
Return the entry name for a given resource identifier.
resid | The resource identifier whose entry name is to be retrieved. |
---|
Resources.NotFoundException |
---|
Return the full name for a given resource identifier. This name is a single string of the form "package:type/entry".
resid | The resource identifier whose name is to be retrieved. |
---|
Resources.NotFoundException |
---|
Return the package name for a given resource identifier.
resid | The resource identifier whose package name is to be retrieved. |
---|
Resources.NotFoundException |
---|
Return the type name for a given resource identifier.
resid | The resource identifier whose type name is to be retrieved. |
---|
Resources.NotFoundException |
---|
Return the string value associated with a particular resource ID, substituting the format arguments as defined in Formatter and format(String, Object...). It will be stripped of any styled text information.
id | The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier. |
---|---|
formatArgs | The format arguments that will be used for substitution. |
Resources.NotFoundException |
---|
Return the string value associated with a particular resource ID. It will be stripped of any styled text information.
id | The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier. |
---|
Resources.NotFoundException |
---|
Return the string array associated with a particular resource ID.
id | The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier. |
---|
Resources.NotFoundException |
---|
Return the string value associated with a particular resource ID. The returned object will be a String if this is a plain string; it will be some other type of CharSequence if it is styled.
id | The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier. |
---|---|
def | The default CharSequence to return. |
Return the string value associated with a particular resource ID. The returned object will be a String if this is a plain string; it will be some other type of CharSequence if it is styled.
id | The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier. |
---|
Resources.NotFoundException |
---|
Return the styled text array associated with a particular resource ID.
id | The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier. |
---|
Resources.NotFoundException |
---|
Return the raw data associated with a particular resource ID. See getIdentifier() for information on how names are mapped to resource IDs, and getString(int) for information on how string resources are retrieved.
Note: use of this function is discouraged. It is much more efficient to retrieve resources by identifier than by name.
name | The name of the desired resource. This is passed to getIdentifier() with a default type of "string". |
---|---|
outValue | Object in which to place the resource data. |
resolveRefs | If true, a resource that is a reference to another resource will be followed so that you receive the actual final resource data. If false, the TypedValue will be filled in with the reference itself. |
Resources.NotFoundException |
---|
Return the raw data associated with a particular resource ID.
id | The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier. |
---|---|
outValue | Object in which to place the resource data. |
resolveRefs | If true, a resource that is a reference to another resource will be followed so that you receive the actual final resource data. If false, the TypedValue will be filled in with the reference itself. |
Resources.NotFoundException |
---|
Return an XmlResourceParser through which you can read a generic XML resource for the given resource ID.
The XmlPullParser implementation returned here has some limited functionality. In particular, you can't change its input, and only high-level parsing events are available (since the document was pre-parsed for you at build time, which involved merging text and stripping comments).
id | The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier. |
---|
Resources.NotFoundException |
---|
Retrieve a set of basic attribute values from an AttributeSet, not performing styling of them using a theme and/or style resources.
set | The current attribute values to retrieve. |
---|---|
attrs | The specific attributes to be retrieved. |
Return an array of heterogeneous values.
id | The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier. |
---|
Resources.NotFoundException |
---|
Open a data stream for reading a raw resource. This can only be used with resources whose value is the name of an asset files -- that is, it can be used to open drawable, sound, and raw resources; it will fail on string and color resources.
id | The resource identifier to open, as generated by the appt tool. |
---|
Resources.NotFoundException |
---|
Open a file descriptor for reading a raw resource. This can only be used with resources whose value is the name of an asset files -- that is, it can be used to open drawable, sound, and raw resources; it will fail on string and color resources.
This function only works for resources that are stored in the package as uncompressed data, which typically includes things like mp3 files and png images.
id | The resource identifier to open, as generated by the appt tool. |
---|
Resources.NotFoundException |
---|
Store the newly updated configuration.