Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Inherited Constants](https://developer.android.com/reference/android/test/mock/MockResources#inhconstants) \| [Ctors](https://developer.android.com/reference/android/test/mock/MockResources#pubctors) \| [Methods](https://developer.android.com/reference/android/test/mock/MockResources#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/test/mock/MockResources#inhmethods)

# MockResources

*** ** * ** ***

` public class MockResources `   
` ` ` extends https://developer.android.com/reference/android/content/res/Resources ` ` `

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) |||
| ↳ | [android.content.res.Resources](https://developer.android.com/reference/android/content/res/Resources) ||
|   | ↳ | android.test.mock.MockResources |

<br />

*** ** * ** ***

<br />

**This class was deprecated in API level 24.**   

Use a mocking framework like [Mockito](https://github.com/mockito/mockito). New tests should be written using the [Android Testing Support Library](https://developer.android.com/tools/testing-support-library).

A mock `https://developer.android.com/reference/android/content/res/Resources` class. All methods are non-functional and throw `https://developer.android.com/reference/java/lang/UnsupportedOperationException`. Override it to provide the operations that you need.

## Summary

### Inherited constants

From class `https://developer.android.com/reference/android/content/res/Resources` `int` `https://developer.android.com/reference/android/content/res/Resources#ID_NULL`

The `null` resource ID.

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/test/mock/MockResources#MockResources()() ` |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/content/res/XmlResourceParser` | ` https://developer.android.com/reference/android/test/mock/MockResources#getAnimation(int)(int id) ` Return an XmlResourceParser through which you can read an animation description for the given resource ID. |
| ` int` | ` https://developer.android.com/reference/android/test/mock/MockResources#getColor(int)(int id) ` *This method is deprecated. Use `https://developer.android.com/reference/android/content/res/Resources#getColor(int,%20android.content.res.Resources.Theme)` instead.* |
| ` https://developer.android.com/reference/android/content/res/ColorStateList` | ` https://developer.android.com/reference/android/test/mock/MockResources#getColorStateList(int)(int id) ` *This method is deprecated. Use `https://developer.android.com/reference/android/content/res/Resources#getColorStateList(int,%20android.content.res.Resources.Theme)` instead.* |
| ` https://developer.android.com/reference/android/content/res/Configuration` | ` https://developer.android.com/reference/android/test/mock/MockResources#getConfiguration()() ` Return the current configuration that is in effect for this resource object. |
| ` float` | ` https://developer.android.com/reference/android/test/mock/MockResources#getDimension(int)(int id) ` Retrieve a dimensional for a particular resource ID. |
| ` int` | ` https://developer.android.com/reference/android/test/mock/MockResources#getDimensionPixelOffset(int)(int id) ` Retrieve a dimensional for a particular resource ID for use as an offset in raw pixels. |
| ` int` | ` https://developer.android.com/reference/android/test/mock/MockResources#getDimensionPixelSize(int)(int id) ` Retrieve a dimensional for a particular resource ID for use as a size in raw pixels. |
| ` https://developer.android.com/reference/android/util/DisplayMetrics` | ` https://developer.android.com/reference/android/test/mock/MockResources#getDisplayMetrics()() ` Returns the current display metrics that are in effect for this resource object. |
| ` https://developer.android.com/reference/android/graphics/drawable/Drawable` | ` https://developer.android.com/reference/android/test/mock/MockResources#getDrawable(int)(int id) ` *This method is deprecated. Use `https://developer.android.com/reference/android/content/res/Resources#getDrawable(int,%20android.content.res.Resources.Theme)` instead.* |
| ` int` | ` https://developer.android.com/reference/android/test/mock/MockResources#getIdentifier(java.lang.String,%20java.lang.String,%20java.lang.String)(https://developer.android.com/reference/java/lang/String name, https://developer.android.com/reference/java/lang/String defType, https://developer.android.com/reference/java/lang/String defPackage) ` Return a resource identifier for the given resource name. |
| ` int[]` | ` https://developer.android.com/reference/android/test/mock/MockResources#getIntArray(int)(int id) ` Return the int array associated with a particular resource ID. |
| ` int` | ` https://developer.android.com/reference/android/test/mock/MockResources#getInteger(int)(int id) ` Return an integer associated with a particular resource ID. |
| ` https://developer.android.com/reference/android/content/res/XmlResourceParser` | ` https://developer.android.com/reference/android/test/mock/MockResources#getLayout(int)(int id) ` Return an XmlResourceParser through which you can read a view layout description for the given resource ID. |
| ` https://developer.android.com/reference/android/graphics/Movie` | ` https://developer.android.com/reference/android/test/mock/MockResources#getMovie(int)(int id) ` *This method is deprecated. Prefer `https://developer.android.com/reference/android/graphics/drawable/AnimatedImageDrawable`.* |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/test/mock/MockResources#getQuantityString(int,%20int,%20java.lang.Object[])(int id, int quantity, https://developer.android.com/reference/java/lang/Object formatArgs) ` Formats the string necessary for grammatically correct pluralization of the given resource ID for the given quantity, using the given arguments. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/test/mock/MockResources#getQuantityString(int,%20int)(int id, int quantity) ` Returns the string necessary for grammatically correct pluralization of the given resource ID for the given quantity. |
| ` https://developer.android.com/reference/java/lang/CharSequence` | ` https://developer.android.com/reference/android/test/mock/MockResources#getQuantityText(int,%20int)(int id, int quantity) ` Returns the character sequence necessary for grammatically correct pluralization of the given resource ID for the given quantity. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/test/mock/MockResources#getResourceEntryName(int)(int resid) ` Return the entry name for a given resource identifier. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/test/mock/MockResources#getResourceName(int)(int resid) ` Return the full name for a given resource identifier. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/test/mock/MockResources#getResourcePackageName(int)(int resid) ` Return the package name for a given resource identifier. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/test/mock/MockResources#getResourceTypeName(int)(int resid) ` Return the type name for a given resource identifier. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/test/mock/MockResources#getString(int)(int id) ` Return the string value associated with a particular resource ID. It will be stripped of any styled text information. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/test/mock/MockResources#getString(int,%20java.lang.Object[])(int id, https://developer.android.com/reference/java/lang/Object formatArgs) ` Return the string value associated with a particular resource ID, substituting the format arguments as defined in `https://developer.android.com/reference/java/util/Formatter` and `https://developer.android.com/reference/java/lang/String#format(java.lang.String,%20java.lang.Object[])`. It will be stripped of any styled text information. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/test/mock/MockResources#getStringArray(int)(int id) ` Return the string array associated with a particular resource ID. |
| ` https://developer.android.com/reference/java/lang/CharSequence` | ` https://developer.android.com/reference/android/test/mock/MockResources#getText(int,%20java.lang.CharSequence)(int id, https://developer.android.com/reference/java/lang/CharSequence def) ` Return the string value associated with a particular resource ID. |
| ` https://developer.android.com/reference/java/lang/CharSequence` | ` https://developer.android.com/reference/android/test/mock/MockResources#getText(int)(int 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. |
| ` https://developer.android.com/reference/java/lang/CharSequence` | ` https://developer.android.com/reference/android/test/mock/MockResources#getTextArray(int)(int id) ` Return the styled text array associated with a particular resource ID. |
| ` void` | ` https://developer.android.com/reference/android/test/mock/MockResources#getValue(java.lang.String,%20android.util.TypedValue,%20boolean)(https://developer.android.com/reference/java/lang/String name, https://developer.android.com/reference/android/util/TypedValue outValue, boolean resolveRefs) ` Return the raw data associated with a particular resource ID. |
| ` void` | ` https://developer.android.com/reference/android/test/mock/MockResources#getValue(int,%20android.util.TypedValue,%20boolean)(int id, https://developer.android.com/reference/android/util/TypedValue outValue, boolean resolveRefs) ` Return the raw data associated with a particular resource ID. |
| ` https://developer.android.com/reference/android/content/res/XmlResourceParser` | ` https://developer.android.com/reference/android/test/mock/MockResources#getXml(int)(int id) ` Return an XmlResourceParser through which you can read a generic XML resource for the given resource ID. |
| ` https://developer.android.com/reference/android/content/res/TypedArray` | ` https://developer.android.com/reference/android/test/mock/MockResources#obtainAttributes(android.util.AttributeSet,%20int[])(https://developer.android.com/reference/android/util/AttributeSet set, int[] attrs) ` Retrieve a set of basic attribute values from an AttributeSet, not performing styling of them using a theme and/or style resources. |
| ` https://developer.android.com/reference/android/content/res/TypedArray` | ` https://developer.android.com/reference/android/test/mock/MockResources#obtainTypedArray(int)(int id) ` Return an array of heterogeneous values. |
| ` https://developer.android.com/reference/java/io/InputStream` | ` https://developer.android.com/reference/android/test/mock/MockResources#openRawResource(int)(int id) ` Open a data stream for reading a raw resource. |
| ` https://developer.android.com/reference/android/content/res/AssetFileDescriptor` | ` https://developer.android.com/reference/android/test/mock/MockResources#openRawResourceFd(int)(int id) ` Open a file descriptor for reading a raw resource. |
| ` void` | ` https://developer.android.com/reference/android/test/mock/MockResources#updateConfiguration(android.content.res.Configuration,%20android.util.DisplayMetrics)(https://developer.android.com/reference/android/content/res/Configuration config, https://developer.android.com/reference/android/util/DisplayMetrics metrics) ` *This method is deprecated. See `https://developer.android.com/reference/android/content/Context#createConfigurationContext(android.content.res.Configuration)`.* |

### Inherited methods

From class ` https://developer.android.com/reference/android/content/res/Resources ` ` void` ` https://developer.android.com/reference/android/content/res/Resources#addLoaders(android.content.res.loader.ResourcesLoader[])(https://developer.android.com/reference/android/content/res/loader/ResourcesLoader loaders) `

Adds a loader to the list of loaders.
` final void` ` https://developer.android.com/reference/android/content/res/Resources#finishPreloading()() `

Called by zygote when it is done preloading resources, to change back to normal Resources operation.
` final void` ` https://developer.android.com/reference/android/content/res/Resources#flushLayoutCache()() `

Call this to remove all cached loaded layout resources from the Resources object.
` https://developer.android.com/reference/android/content/res/XmlResourceParser` ` https://developer.android.com/reference/android/content/res/Resources#getAnimation(int)(int id) `

Return an XmlResourceParser through which you can read an animation description for the given resource ID.
` final https://developer.android.com/reference/android/content/res/AssetManager` ` https://developer.android.com/reference/android/content/res/Resources#getAssets()() `

Retrieve underlying AssetManager storage for these resources.
` static int` ` https://developer.android.com/reference/android/content/res/Resources#getAttributeSetSourceResId(android.util.AttributeSet)(https://developer.android.com/reference/android/util/AttributeSet set) `

Returns the resource ID of the resource that was used to create this AttributeSet.
` boolean` ` https://developer.android.com/reference/android/content/res/Resources#getBoolean(int)(int id) `

Return a boolean associated with a particular resource ID.
` int` ` https://developer.android.com/reference/android/content/res/Resources#getColor(int)(int id) `

*This method was deprecated in API level 23. Use `https://developer.android.com/reference/android/content/res/Resources#getColor(int,%20android.content.res.Resources.Theme)` instead.*
` int` ` https://developer.android.com/reference/android/content/res/Resources#getColor(int,%20android.content.res.Resources.Theme)(int id, https://developer.android.com/reference/android/content/res/Resources.Theme theme) `

Returns a themed color integer associated with a particular resource ID.
` https://developer.android.com/reference/android/content/res/ColorStateList` ` https://developer.android.com/reference/android/content/res/Resources#getColorStateList(int,%20android.content.res.Resources.Theme)(int id, https://developer.android.com/reference/android/content/res/Resources.Theme theme) `

Returns a themed color state list associated with a particular resource ID.
` https://developer.android.com/reference/android/content/res/ColorStateList` ` https://developer.android.com/reference/android/content/res/Resources#getColorStateList(int)(int id) `

*This method was deprecated in API level 23. Use `https://developer.android.com/reference/android/content/res/Resources#getColorStateList(int,%20android.content.res.Resources.Theme)` instead.*
` https://developer.android.com/reference/android/content/res/Configuration` ` https://developer.android.com/reference/android/content/res/Resources#getConfiguration()() `

Return the current configuration that is in effect for this resource object.
` float` ` https://developer.android.com/reference/android/content/res/Resources#getDimension(int)(int id) `

Retrieve a dimensional for a particular resource ID.
` int` ` https://developer.android.com/reference/android/content/res/Resources#getDimensionPixelOffset(int)(int id) `

Retrieve a dimensional for a particular resource ID for use as an offset in raw pixels.
` int` ` https://developer.android.com/reference/android/content/res/Resources#getDimensionPixelSize(int)(int id) `

Retrieve a dimensional for a particular resource ID for use as a size in raw pixels.
` https://developer.android.com/reference/android/util/DisplayMetrics` ` https://developer.android.com/reference/android/content/res/Resources#getDisplayMetrics()() `

Returns the current display metrics that are in effect for this resource object.
` https://developer.android.com/reference/android/graphics/drawable/Drawable` ` https://developer.android.com/reference/android/content/res/Resources#getDrawable(int,%20android.content.res.Resources.Theme)(int id, https://developer.android.com/reference/android/content/res/Resources.Theme theme) `

Return a drawable object associated with a particular resource ID and styled for the specified theme.
` https://developer.android.com/reference/android/graphics/drawable/Drawable` ` https://developer.android.com/reference/android/content/res/Resources#getDrawable(int)(int id) `

*This method was deprecated in API level 22. Use `https://developer.android.com/reference/android/content/res/Resources#getDrawable(int,%20android.content.res.Resources.Theme)` instead.*
` https://developer.android.com/reference/android/graphics/drawable/Drawable` ` https://developer.android.com/reference/android/content/res/Resources#getDrawableForDensity(int,%20int)(int id, int density) `

*This method was deprecated in API level 22. Use `https://developer.android.com/reference/android/content/res/Resources#getDrawableForDensity(int,%20int,%20android.content.res.Resources.Theme)` instead.*
` https://developer.android.com/reference/android/graphics/drawable/Drawable` ` https://developer.android.com/reference/android/content/res/Resources#getDrawableForDensity(int,%20int,%20android.content.res.Resources.Theme)(int id, int density, https://developer.android.com/reference/android/content/res/Resources.Theme theme) `

Return a drawable object associated with a particular resource ID for the given screen density in DPI and styled for the specified theme.
` float` ` https://developer.android.com/reference/android/content/res/Resources#getFloat(int)(int id) `

Retrieve a floating-point value for a particular resource ID.
` https://developer.android.com/reference/android/graphics/Typeface` ` https://developer.android.com/reference/android/content/res/Resources#getFont(int)(int id) `

Return the Typeface value associated with a particular resource ID.
` float` ` https://developer.android.com/reference/android/content/res/Resources#getFraction(int,%20int,%20int)(int id, int base, int pbase) `

Retrieve a fractional unit for a particular resource ID.
` int` ` https://developer.android.com/reference/android/content/res/Resources#getIdentifier(java.lang.String,%20java.lang.String,%20java.lang.String)(https://developer.android.com/reference/java/lang/String name, https://developer.android.com/reference/java/lang/String defType, https://developer.android.com/reference/java/lang/String defPackage) `

Return a resource identifier for the given resource name.
` int[]` ` https://developer.android.com/reference/android/content/res/Resources#getIntArray(int)(int id) `

Return the int array associated with a particular resource ID.
` int` ` https://developer.android.com/reference/android/content/res/Resources#getInteger(int)(int id) `

Return an integer associated with a particular resource ID.
` https://developer.android.com/reference/android/content/res/XmlResourceParser` ` https://developer.android.com/reference/android/content/res/Resources#getLayout(int)(int id) `

Return an XmlResourceParser through which you can read a view layout description for the given resource ID.
` https://developer.android.com/reference/android/graphics/Movie` ` https://developer.android.com/reference/android/content/res/Resources#getMovie(int)(int id) `

*This method was deprecated in API level 29. Prefer `https://developer.android.com/reference/android/graphics/drawable/AnimatedImageDrawable`.*
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/android/content/res/Resources#getQuantityString(int,%20int,%20java.lang.Object[])(int id, int quantity, https://developer.android.com/reference/java/lang/Object formatArgs) `

Formats the string necessary for grammatically correct pluralization of the given resource ID for the given quantity, using the given arguments.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/android/content/res/Resources#getQuantityString(int,%20int)(int id, int quantity) `

Returns the string necessary for grammatically correct pluralization of the given resource ID for the given quantity.
` https://developer.android.com/reference/java/lang/CharSequence` ` https://developer.android.com/reference/android/content/res/Resources#getQuantityText(int,%20int)(int id, int quantity) `

Returns the character sequence necessary for grammatically correct pluralization of the given resource ID for the given quantity.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/android/content/res/Resources#getResourceEntryName(int)(int resid) `

Return the entry name for a given resource identifier.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/android/content/res/Resources#getResourceName(int)(int resid) `

Return the full name for a given resource identifier.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/android/content/res/Resources#getResourcePackageName(int)(int resid) `

Return the package name for a given resource identifier.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/android/content/res/Resources#getResourceTypeName(int)(int resid) `

Return the type name for a given resource identifier.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/android/content/res/Resources#getString(int)(int id) `

Return the string value associated with a particular resource ID. It will be stripped of any styled text information.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/android/content/res/Resources#getString(int,%20java.lang.Object[])(int id, https://developer.android.com/reference/java/lang/Object formatArgs) `

Return the string value associated with a particular resource ID, substituting the format arguments as defined in `https://developer.android.com/reference/java/util/Formatter` and `https://developer.android.com/reference/java/lang/String#format(java.lang.String,%20java.lang.Object[])`. It will be stripped of any styled text information.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/android/content/res/Resources#getStringArray(int)(int id) `

Return the string array associated with a particular resource ID.
` static https://developer.android.com/reference/android/content/res/Resources` ` https://developer.android.com/reference/android/content/res/Resources#getSystem()() `

Return a global shared Resources object that provides access to only system resources (no application resources), is not configured for the current screen (can not use dimension units, does not change based on orientation, etc), and is not affected by Runtime Resource Overlay.
` https://developer.android.com/reference/java/lang/CharSequence` ` https://developer.android.com/reference/android/content/res/Resources#getText(int,%20java.lang.CharSequence)(int id, https://developer.android.com/reference/java/lang/CharSequence def) `

Return the string value associated with a particular resource ID.
` https://developer.android.com/reference/java/lang/CharSequence` ` https://developer.android.com/reference/android/content/res/Resources#getText(int)(int 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.
` https://developer.android.com/reference/java/lang/CharSequence` ` https://developer.android.com/reference/android/content/res/Resources#getTextArray(int)(int id) `

Return the styled text array associated with a particular resource ID.
` void` ` https://developer.android.com/reference/android/content/res/Resources#getValue(java.lang.String,%20android.util.TypedValue,%20boolean)(https://developer.android.com/reference/java/lang/String name, https://developer.android.com/reference/android/util/TypedValue outValue, boolean resolveRefs) `

Return the raw data associated with a particular resource ID.
` void` ` https://developer.android.com/reference/android/content/res/Resources#getValue(int,%20android.util.TypedValue,%20boolean)(int id, https://developer.android.com/reference/android/util/TypedValue outValue, boolean resolveRefs) `

Return the raw data associated with a particular resource ID.
` void` ` https://developer.android.com/reference/android/content/res/Resources#getValueForDensity(int,%20int,%20android.util.TypedValue,%20boolean)(int id, int density, https://developer.android.com/reference/android/util/TypedValue outValue, boolean resolveRefs) `

Get the raw value associated with a resource with associated density.
` https://developer.android.com/reference/android/content/res/XmlResourceParser` ` https://developer.android.com/reference/android/content/res/Resources#getXml(int)(int id) `

Return an XmlResourceParser through which you can read a generic XML resource for the given resource ID.
` final https://developer.android.com/reference/android/content/res/Resources.Theme` ` https://developer.android.com/reference/android/content/res/Resources#newTheme()() `

Generate a new Theme object for this set of Resources.
` https://developer.android.com/reference/android/content/res/TypedArray` ` https://developer.android.com/reference/android/content/res/Resources#obtainAttributes(android.util.AttributeSet,%20int[])(https://developer.android.com/reference/android/util/AttributeSet set, int[] attrs) `

Retrieve a set of basic attribute values from an AttributeSet, not performing styling of them using a theme and/or style resources.
` https://developer.android.com/reference/android/content/res/TypedArray` ` https://developer.android.com/reference/android/content/res/Resources#obtainTypedArray(int)(int id) `

Return an array of heterogeneous values.
` https://developer.android.com/reference/java/io/InputStream` ` https://developer.android.com/reference/android/content/res/Resources#openRawResource(int,%20android.util.TypedValue)(int id, https://developer.android.com/reference/android/util/TypedValue value) `

Open a data stream for reading a raw resource.
` https://developer.android.com/reference/java/io/InputStream` ` https://developer.android.com/reference/android/content/res/Resources#openRawResource(int)(int id) `

Open a data stream for reading a raw resource.
` https://developer.android.com/reference/android/content/res/AssetFileDescriptor` ` https://developer.android.com/reference/android/content/res/Resources#openRawResourceFd(int)(int id) `

Open a file descriptor for reading a raw resource.
` void` ` https://developer.android.com/reference/android/content/res/Resources#parseBundleExtra(java.lang.String,%20android.util.AttributeSet,%20android.os.Bundle)(https://developer.android.com/reference/java/lang/String tagName, https://developer.android.com/reference/android/util/AttributeSet attrs, https://developer.android.com/reference/android/os/Bundle outBundle) `

Parse a name/value pair out of an XML tag holding that data.
` void` ` https://developer.android.com/reference/android/content/res/Resources#parseBundleExtras(android.content.res.XmlResourceParser,%20android.os.Bundle)(https://developer.android.com/reference/android/content/res/XmlResourceParser parser, https://developer.android.com/reference/android/os/Bundle outBundle) `

Parse a series of `https://developer.android.com/reference/android/R.styleable#Extra` tags from an XML file.
` static void` ` https://developer.android.com/reference/android/content/res/Resources#registerResourcePaths(java.lang.String,%20android.content.pm.ApplicationInfo)(https://developer.android.com/reference/java/lang/String uniqueId, https://developer.android.com/reference/android/content/pm/ApplicationInfo appInfo) `

Register the resources paths of a package (e.g. a shared library).
` void` ` https://developer.android.com/reference/android/content/res/Resources#removeLoaders(android.content.res.loader.ResourcesLoader[])(https://developer.android.com/reference/android/content/res/loader/ResourcesLoader loaders) `

Removes loaders from the list of loaders.
` void` ` https://developer.android.com/reference/android/content/res/Resources#updateConfiguration(android.content.res.Configuration,%20android.util.DisplayMetrics)(https://developer.android.com/reference/android/content/res/Configuration config, https://developer.android.com/reference/android/util/DisplayMetrics metrics) `

*This method was deprecated in API level 25. See `https://developer.android.com/reference/android/content/Context#createConfigurationContext(android.content.res.Configuration)`.*
From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Public constructors

### MockResources

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public MockResources ()
```

<br />

<br />

## Public methods

### getAnimation

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public XmlResourceParser getAnimation (int id)
```

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 `https://developer.android.com/reference/android/content/res/Resources#getXml(int)` with an animation resource.

<br />

| Parameters ||
|---|---|
| `id` | `int`: 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. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/res/XmlResourceParser` | A new parser object through which you can read the XML data. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/res/Resources.NotFoundException` |   |

### getColor

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getColor (int id)
```

<br />

**This method is deprecated.**   

Use `https://developer.android.com/reference/android/content/res/Resources#getColor(int,%20android.content.res.Resources.Theme)` instead.

Returns a color integer associated with a particular resource ID. If the resource holds a complex `https://developer.android.com/reference/android/content/res/ColorStateList`, then the default color from the set is returned.

<br />

| Parameters ||
|---|---|
| `id` | `int`: 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. <br /> |

| Returns ||
|---|---|
| `int` | A single color value in the form 0xAARRGGBB. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/res/Resources.NotFoundException` |   |

### getColorStateList

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ColorStateList getColorStateList (int id)
```

<br />

**This method is deprecated.**   

Use `https://developer.android.com/reference/android/content/res/Resources#getColorStateList(int,%20android.content.res.Resources.Theme)` instead.

Returns a color state list associated with a particular resource ID. The resource may contain either a single raw color value or a complex `https://developer.android.com/reference/android/content/res/ColorStateList` holding multiple possible colors.

<br />

| Parameters ||
|---|---|
| `id` | `int`: The desired resource identifier of a `https://developer.android.com/reference/android/content/res/ColorStateList`, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/res/ColorStateList` | A ColorStateList object containing either a single solid color or multiple colors that can be selected based on a state. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/res/Resources.NotFoundException` |   |

### getConfiguration

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Configuration getConfiguration ()
```

Return the current configuration that is in effect for this resource object. The returned object should be treated as read-only.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/res/Configuration` | The resource's current configuration. <br /> |

### getDimension

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public float getDimension (int id)
```

Retrieve a dimensional for a particular resource ID. Unit conversions are based on the current `https://developer.android.com/reference/android/util/DisplayMetrics` associated with the resources.

<br />

| Parameters ||
|---|---|
| `id` | `int`: 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. <br /> |

| Returns ||
|---|---|
| `float` | Resource dimension value multiplied by the appropriate metric to convert to pixels. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/res/Resources.NotFoundException` |   |

### getDimensionPixelOffset

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getDimensionPixelOffset (int id)
```

Retrieve a dimensional for a particular resource ID for use as an offset in raw pixels. This is the same as `https://developer.android.com/reference/android/content/res/Resources#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.

<br />

| Parameters ||
|---|---|
| `id` | `int`: 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. <br /> |

| Returns ||
|---|---|
| `int` | Resource dimension value multiplied by the appropriate metric and truncated to integer pixels. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/res/Resources.NotFoundException` |   |

### getDimensionPixelSize

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getDimensionPixelSize (int id)
```

Retrieve a dimensional for a particular resource ID for use as a size in raw pixels. This is the same as `https://developer.android.com/reference/android/content/res/Resources#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.

<br />

| Parameters ||
|---|---|
| `id` | `int`: 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. <br /> |

| Returns ||
|---|---|
| `int` | Resource dimension value multiplied by the appropriate metric and truncated to integer pixels. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/res/Resources.NotFoundException` |   |

### getDisplayMetrics

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public DisplayMetrics getDisplayMetrics ()
```

Returns the current display metrics that are in effect for this resource object. The returned object should be treated as read-only.

Note that the reported value may be different than the window this application is interested in.

The best practices is to obtain metrics from `https://developer.android.com/reference/android/view/WindowManager#getCurrentWindowMetrics()` for window bounds. The value obtained from this API may be wrong if `https://developer.android.com/reference/android/content/Context#getResources()` is not from a `UiContext`. For example, use the `https://developer.android.com/reference/android/util/DisplayMetrics` obtained from `https://developer.android.com/reference/android/content/ContextWrapper#getResources()` to build `https://developer.android.com/reference/android/app/Activity` UI elements especially when the `https://developer.android.com/reference/android/app/Activity` is in the multi-window mode or on the secondary `https://developer.android.com/reference/android/view/Display`.

<br />

<br />

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/util/DisplayMetrics` | The resource's current display metrics. <br /> |

### getDrawable

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Drawable getDrawable (int id)
```

<br />

**This method is deprecated.**   

Use `https://developer.android.com/reference/android/content/res/Resources#getDrawable(int,%20android.content.res.Resources.Theme)` instead.

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.

**Note:** Prior to `https://developer.android.com/reference/android/os/Build.VERSION_CODES#JELLY_BEAN`, this function would not correctly retrieve the final configuration density when the resource ID passed here is an alias to another Drawable resource. This means that if the density configuration of the alias resource is different than the actual resource, the density of the returned Drawable would be incorrect, resulting in bad scaling. To work around this, you can instead manually resolve the aliased reference by using `https://developer.android.com/reference/android/content/res/Resources#getValue(int,%20android.util.TypedValue,%20boolean)` and passing `true` for `resolveRefs`. The resulting `https://developer.android.com/reference/android/util/TypedValue#resourceId` value may be passed to this method.

**Note:** To obtain a themed drawable, use `https://developer.android.com/reference/android/content/Context#getDrawable(int)` or `https://developer.android.com/reference/android/content/res/Resources#getDrawable(int,%20android.content.res.Resources.Theme)` passing the desired theme.

<br />

<br />

| Parameters ||
|---|---|
| `id` | `int`: 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. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/drawable/Drawable` | Drawable An object that can be used to draw this resource. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/res/Resources.NotFoundException` |   |

### getIdentifier

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getIdentifier (String name, 
                String defType, 
                String defPackage)
```

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.

<br />

| Parameters ||
|---|---|
| `name` | `String`: The name of the desired resource. <br /> |
| `defType` | `String`: Optional default resource type to find, if "type/" is not included in the name. Can be null to require an explicit type. <br /> |
| `defPackage` | `String`: Optional default package to find, if "package:" is not included in the name. Can be null to require an explicit package. <br /> |

| Returns ||
|---|---|
| `int` | int The associated resource identifier. Returns 0 if no such resource was found. (0 is not a valid resource ID.) <br /> |

### getIntArray

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int[] getIntArray (int id)
```

Return the int array associated with a particular resource ID.

<br />

| Parameters ||
|---|---|
| `id` | `int`: 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. <br /> |

| Returns ||
|---|---|
| `int[]` | The int array associated with the resource. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/res/Resources.NotFoundException` |   |

### getInteger

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getInteger (int id)
```

Return an integer associated with a particular resource ID.

<br />

| Parameters ||
|---|---|
| `id` | `int`: 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. <br /> |

| Returns ||
|---|---|
| `int` | Returns the integer value contained in the resource. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/res/Resources.NotFoundException` |   |

### getLayout

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public XmlResourceParser getLayout (int id)
```

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 `https://developer.android.com/reference/android/content/res/Resources#getXml(int)` with a layout resource.

<br />

| Parameters ||
|---|---|
| `id` | `int`: 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. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/res/XmlResourceParser` | A new parser object through which you can read the XML data. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/res/Resources.NotFoundException` |   |

### getMovie

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Movie getMovie (int id)
```

<br />

**This method is deprecated.**   

Prefer `https://developer.android.com/reference/android/graphics/drawable/AnimatedImageDrawable`.

Return a movie object associated with the particular resource ID.

<br />

| Parameters ||
|---|---|
| `id` | `int`: 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. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/Movie` | <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/res/Resources.NotFoundException` |   |

### getQuantityString

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String getQuantityString (int id, 
                int quantity, 
                Object... formatArgs)
```

Formats the string necessary for grammatically correct pluralization of the given resource ID for the given quantity, using the given arguments. Note that the string is selected based solely on grammatical necessity, and that such rules differ between languages. Do not assume you know which string will be returned for a given quantity. See [String Resources](https://developer.android.com/guide/topics/resources/string-resource#Plurals) for more detail.

Substitution of format arguments works as if using `https://developer.android.com/reference/java/util/Formatter` and `https://developer.android.com/reference/java/lang/String#format(java.lang.String,%20java.lang.Object[])`. The resulting string will be stripped of any styled text information.

<br />

| Parameters ||
|---|---|
| `id` | `int`: 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. <br /> |
| `quantity` | `int`: The number used to get the correct string for the current language's plural rules. <br /> |
| `formatArgs` | `Object`: The format arguments that will be used for substitution. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | String The string data associated with the resource, stripped of styled text information. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/res/Resources.NotFoundException` |   |

### getQuantityString

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String getQuantityString (int id, 
                int quantity)
```

Returns the string necessary for grammatically correct pluralization of the given resource ID for the given quantity. Note that the string is selected based solely on grammatical necessity, and that such rules differ between languages. Do not assume you know which string will be returned for a given quantity. See [String Resources](https://developer.android.com/guide/topics/resources/string-resource#Plurals) for more detail.

<br />

| Parameters ||
|---|---|
| `id` | `int`: 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. <br /> |
| `quantity` | `int`: The number used to get the correct string for the current language's plural rules. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | String The string data associated with the resource, stripped of styled text information. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/res/Resources.NotFoundException` |   |

### getQuantityText

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public CharSequence getQuantityText (int id, 
                int quantity)
```

Returns the character sequence necessary for grammatically correct pluralization of the given resource ID for the given quantity. Note that the character sequence is selected based solely on grammatical necessity, and that such rules differ between languages. Do not assume you know which string will be returned for a given quantity. See [String Resources](https://developer.android.com/guide/topics/resources/string-resource#Plurals) for more detail.

<br />

| Parameters ||
|---|---|
| `id` | `int`: 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. <br /> |
| `quantity` | `int`: The number used to get the correct string for the current language's plural rules. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence` | CharSequence The string data associated with the resource, plus possibly styled text information. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/res/Resources.NotFoundException` |   |

### getResourceEntryName

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String getResourceEntryName (int resid)
```

Return the entry name for a given resource identifier.

<br />

| Parameters ||
|---|---|
| `resid` | `int`: The resource identifier whose entry name is to be retrieved. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | A string holding the entry name of the resource. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/res/Resources.NotFoundException` |   |

### getResourceName

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String getResourceName (int resid)
```

Return the full name for a given resource identifier. This name is a single string of the form "package:type/entry".

<br />

| Parameters ||
|---|---|
| `resid` | `int`: The resource identifier whose name is to be retrieved. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | A string holding the name of the resource. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/res/Resources.NotFoundException` |   |

### getResourcePackageName

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String getResourcePackageName (int resid)
```

Return the package name for a given resource identifier.

<br />

| Parameters ||
|---|---|
| `resid` | `int`: The resource identifier whose package name is to be retrieved. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | A string holding the package name of the resource. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/res/Resources.NotFoundException` |   |

### getResourceTypeName

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String getResourceTypeName (int resid)
```

Return the type name for a given resource identifier.

<br />

| Parameters ||
|---|---|
| `resid` | `int`: The resource identifier whose type name is to be retrieved. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | A string holding the type name of the resource. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/res/Resources.NotFoundException` |   |

### getString

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String getString (int id)
```

Return the string value associated with a particular resource ID. It will be stripped of any styled text information.

<br />

<br />

| Parameters ||
|---|---|
| `id` | `int`: 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. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | String The string data associated with the resource, stripped of styled text information. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/res/Resources.NotFoundException` |   |

### getString

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String getString (int id, 
                Object... formatArgs)
```

Return the string value associated with a particular resource ID, substituting the format arguments as defined in `https://developer.android.com/reference/java/util/Formatter` and `https://developer.android.com/reference/java/lang/String#format(java.lang.String,%20java.lang.Object[])`. It will be stripped of any styled text information.

<br />

<br />

| Parameters ||
|---|---|
| `id` | `int`: 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. <br /> |
| `formatArgs` | `Object`: The format arguments that will be used for substitution. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | String The string data associated with the resource, stripped of styled text information. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/res/Resources.NotFoundException` |   |

### getStringArray

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String[] getStringArray (int id)
```

Return the string array associated with a particular resource ID.

<br />

| Parameters ||
|---|---|
| `id` | `int`: 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. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | The string array associated with the resource. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/res/Resources.NotFoundException` |   |

### getText

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public CharSequence getText (int id, 
                CharSequence def)
```

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.

<br />

| Parameters ||
|---|---|
| `id` | `int`: 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. <br /> |
| `def` | `CharSequence`: The default CharSequence to return. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence` | CharSequence The string data associated with the resource, plus possibly styled text information, or def if id is 0 or not found. <br /> |

### getText

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public CharSequence getText (int 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.

<br />

<br />

| Parameters ||
|---|---|
| `id` | `int`: 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. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence` | CharSequence The string data associated with the resource, plus possibly styled text information. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/res/Resources.NotFoundException` |   |

### getTextArray

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public CharSequence[] getTextArray (int id)
```

Return the styled text array associated with a particular resource ID.

<br />

| Parameters ||
|---|---|
| `id` | `int`: 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. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence` | The styled text array associated with the resource. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/res/Resources.NotFoundException` |   |

### getValue

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void getValue (String name, 
                TypedValue outValue, 
                boolean resolveRefs)
```

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.

<br />

| Parameters ||
|---|---|
| `name` | `String`: The name of the desired resource. This is passed to getIdentifier() with a default type of "string". <br /> |
| `outValue` | `TypedValue`: Object in which to place the resource data. <br /> |
| `resolveRefs` | `boolean`: 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. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/res/Resources.NotFoundException` |   |

### getValue

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void getValue (int id, 
                TypedValue outValue, 
                boolean resolveRefs)
```

Return the raw data associated with a particular resource ID.

<br />

| Parameters ||
|---|---|
| `id` | `int`: 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. <br /> |
| `outValue` | `TypedValue`: Object in which to place the resource data. <br /> |
| `resolveRefs` | `boolean`: 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. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/res/Resources.NotFoundException` |   |

### getXml

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public XmlResourceParser getXml (int id)
```

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).

<br />

| Parameters ||
|---|---|
| `id` | `int`: 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. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/res/XmlResourceParser` | A new parser object through which you can read the XML data. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/res/Resources.NotFoundException` |   |

### obtainAttributes

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public TypedArray obtainAttributes (AttributeSet set, 
                int[] attrs)
```

Retrieve a set of basic attribute values from an AttributeSet, not performing styling of them using a theme and/or style resources.

<br />

| Parameters ||
|---|---|
| `set` | `AttributeSet`: The current attribute values to retrieve. <br /> |
| `attrs` | `int`: The specific attributes to be retrieved. These attribute IDs must be sorted in ascending order. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/res/TypedArray` | Returns a TypedArray holding an array of the attribute values. Be sure to call `https://developer.android.com/reference/android/content/res/TypedArray#recycle()` when done with it. <br /> |

### obtainTypedArray

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public TypedArray obtainTypedArray (int id)
```

Return an array of heterogeneous values.

<br />

| Parameters ||
|---|---|
| `id` | `int`: 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. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/res/TypedArray` | Returns a TypedArray holding an array of the array values. Be sure to call `https://developer.android.com/reference/android/content/res/TypedArray#recycle()` when done with it. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/res/Resources.NotFoundException` |   |

### openRawResource

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public InputStream openRawResource (int id)
```

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.

<br />

| Parameters ||
|---|---|
| `id` | `int`: The resource identifier to open, as generated by the aapt tool. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/io/InputStream` | InputStream Access to the resource data. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/res/Resources.NotFoundException` |   |

### openRawResourceFd

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public AssetFileDescriptor openRawResourceFd (int id)
```

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.

<br />

| Parameters ||
|---|---|
| `id` | `int`: The resource identifier to open, as generated by the aapt tool. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/res/AssetFileDescriptor` | AssetFileDescriptor A new file descriptor you can use to read the resource. This includes the file descriptor itself, as well as the offset and length of data where the resource appears in the file. A null is returned if the file exists but is compressed. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/res/Resources.NotFoundException` |   |

### updateConfiguration

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void updateConfiguration (Configuration config, 
                DisplayMetrics metrics)
```

<br />

**This method is deprecated.**   

See `https://developer.android.com/reference/android/content/Context#createConfigurationContext(android.content.res.Configuration)`.

Store the newly updated configuration.

<br />

| Parameters ||
|---|---|
| `config` | `Configuration` <br /> |
| `metrics` | `DisplayMetrics` <br /> |