Resources Resources Class

Definition

Class for accessing an application's resources.

[Android.Runtime.Register("android/content/res/Resources", ApiSince=1, DoNotGenerateAcw=true)]
public class Resources : Java.Lang.Object
type Resources = class
    inherit Object
Inheritance
ResourcesResources
Derived
Attributes

Remarks

Android platform documentation

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

Resources(AssetManager, DisplayMetrics, Configuration) Resources(AssetManager, DisplayMetrics, Configuration)

Create a new Resources object on top of an existing set of assets in an AssetManager.

Resources(IntPtr, JniHandleOwnership) Resources(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Properties

Assets Assets

Retrieve underlying AssetManager storage for these resources.

Class Class

Returns the unique instance of Class that represents this object's class.

(Inherited from Object)
Configuration Configuration

Return the current configuration that is in effect for this resource object.

DisplayMetrics DisplayMetrics

Return the current display metrics that are in effect for this resource object.

Handle Handle

The handle to the underlying Android instance.

(Inherited from Object)
IJavaObjectEx.IsProxy IJavaObjectEx.IsProxy Inherited from Object
IJavaObjectEx.KeyHandle IJavaObjectEx.KeyHandle Inherited from Object
IJavaObjectEx.NeedsActivation IJavaObjectEx.NeedsActivation Inherited from Object
IJavaPeerable.JniManagedPeerState IJavaPeerable.JniManagedPeerState Inherited from Object
JniIdentityHashCode JniIdentityHashCode Inherited from Object
JniPeerMembers JniPeerMembers
PeerReference PeerReference Inherited from Object
System System
ThresholdClass ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Methods

Clone() Clone()

Creates and returns a copy of this Object.

(Inherited from Object)
Dispose() Dispose() Inherited from Object
Dispose(Boolean) Dispose(Boolean) Inherited from Object
Equals(Object) Equals(Object)

Compares this instance with the specified object and indicates if they are equal.

(Inherited from Object)
FinishPreloading() FinishPreloading()

Called by zygote when it is done preloading resources, to change back to normal Resources operation.

FlushLayoutCache() FlushLayoutCache()

Call this to remove all cached loaded layout resources from the Resources object.

GetAnimation(Int32) GetAnimation(Int32)

Return an XmlResourceParser through which you can read an animation description for the given resource ID.

GetBoolean(Int32) GetBoolean(Int32)

Return a boolean associated with a particular resource ID.

GetColor(Int32) GetColor(Int32)

Returns a color integer associated with a particular resource ID.

GetColor(Int32, Resources+Theme) GetColor(Int32, Resources+Theme)
GetColorStateList(Int32) GetColorStateList(Int32)

Returns a color state list associated with a particular resource ID.

GetColorStateList(Int32, Resources+Theme) GetColorStateList(Int32, Resources+Theme)
GetDimension(Int32) GetDimension(Int32)

Retrieve a dimensional for a particular resource ID.

GetDimensionPixelOffset(Int32) GetDimensionPixelOffset(Int32)

Retrieve a dimensional for a particular resource ID for use as an offset in raw pixels.

GetDimensionPixelSize(Int32) GetDimensionPixelSize(Int32)

Retrieve a dimensional for a particular resource ID for use as a size in raw pixels.

GetDrawable(Int32) GetDrawable(Int32)

Return a drawable object associated with a particular resource ID.

GetDrawable(Int32, Resources+Theme) GetDrawable(Int32, Resources+Theme)

Return a drawable object associated with a particular resource ID and styled for the specified theme.

GetDrawableForDensity(Int32, Int32) GetDrawableForDensity(Int32, Int32)

Return a drawable object associated with a particular resource ID for the given screen density in DPI.

GetDrawableForDensity(Int32, Int32, Resources+Theme) GetDrawableForDensity(Int32, Int32, Resources+Theme)

Return a drawable object associated with a particular resource ID for the given screen density in DPI and styled for the specified theme.

GetFont(Int32) GetFont(Int32)
GetFraction(Int32, Int32, Int32) GetFraction(Int32, Int32, Int32)

Retrieve a fractional unit for a particular resource ID.

GetHashCode() GetHashCode()

Returns an integer hash code for this object.

(Inherited from Object)
GetIdentifier(String, String, String) GetIdentifier(String, String, String)

Return a resource identifier for the given resource name.

GetIntArray(Int32) GetIntArray(Int32)

Return the int array associated with a particular resource ID.

GetInteger(Int32) GetInteger(Int32)

Return an integer associated with a particular resource ID.

GetLayout(Int32) GetLayout(Int32)

Return an XmlResourceParser through which you can read a view layout description for the given resource ID.

GetMovie(Int32) GetMovie(Int32)

Return a movie object associated with the particular resource ID.

GetQuantityString(Int32, Int32) GetQuantityString(Int32, Int32)

Returns the string necessary for grammatically correct pluralization of the given resource ID for the given quantity.

GetQuantityString(Int32, Int32, Object[]) GetQuantityString(Int32, Int32, Object[])
GetQuantityText(Int32, Int32) GetQuantityText(Int32, Int32)
GetQuantityTextFormatted(Int32, Int32) GetQuantityTextFormatted(Int32, Int32)

Returns the character sequence necessary for grammatically correct pluralization of the given resource ID for the given quantity.

GetResourceEntryName(Int32) GetResourceEntryName(Int32)

Return the entry name for a given resource identifier.

GetResourceName(Int32) GetResourceName(Int32)

Return the full name for a given resource identifier.

GetResourcePackageName(Int32) GetResourcePackageName(Int32)

Return the package name for a given resource identifier.

GetResourceTypeName(Int32) GetResourceTypeName(Int32)

Return the type name for a given resource identifier.

GetString(Int32) GetString(Int32)

Return the string value associated with a particular resource ID.

GetString(Int32, Object[]) GetString(Int32, Object[])
GetStringArray(Int32) GetStringArray(Int32)

Return the string array associated with a particular resource ID.

GetText(Int32) GetText(Int32)
GetText(Int32, String) GetText(Int32, String)
GetTextArray(Int32) GetTextArray(Int32)
GetTextArrayFormatted(Int32) GetTextArrayFormatted(Int32)

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

GetTextFormatted(Int32) GetTextFormatted(Int32)

Return the string value associated with a particular resource ID.

GetTextFormatted(Int32, ICharSequence) GetTextFormatted(Int32, ICharSequence)

Return the string value associated with a particular resource ID.

GetValue(Int32, TypedValue, Boolean) GetValue(Int32, TypedValue, Boolean)

Return the raw data associated with a particular resource ID.

GetValue(String, TypedValue, Boolean) GetValue(String, TypedValue, Boolean)

Return the raw data associated with a particular resource ID.

GetValueForDensity(Int32, Int32, TypedValue, Boolean) GetValueForDensity(Int32, Int32, TypedValue, Boolean)

Get the raw value associated with a resource with associated density.

GetXml(Int32) GetXml(Int32)

Return an XmlResourceParser through which you can read a generic XML resource for the given resource ID.

JavaFinalize() JavaFinalize()

Invoked when the garbage collector has detected that this instance is no longer reachable.

(Inherited from Object)
NewTheme() NewTheme()

Generate a new Theme object for this set of Resources.

Notify() Notify()

Causes a thread which is waiting on this object's monitor (by means of calling one of the wait() methods) to be woken up.

(Inherited from Object)
NotifyAll() NotifyAll()

Causes all threads which are waiting on this object's monitor (by means of calling one of the wait() methods) to be woken up.

(Inherited from Object)
ObtainAttributes(IAttributeSet, Int32[]) ObtainAttributes(IAttributeSet, Int32[])

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

ObtainTypedArray(Int32) ObtainTypedArray(Int32)

Return an array of heterogeneous values.

OpenRawResource(Int32) OpenRawResource(Int32)

Open a data stream for reading a raw resource.

OpenRawResource(Int32, TypedValue) OpenRawResource(Int32, TypedValue)

Open a data stream for reading a raw resource.

OpenRawResourceFd(Int32) OpenRawResourceFd(Int32)

Open a file descriptor for reading a raw resource.

ParseBundleExtra(String, IAttributeSet, Bundle) ParseBundleExtra(String, IAttributeSet, Bundle)

Parse a name/value pair out of an XML tag holding that data.

ParseBundleExtras(XmlReader, Bundle) ParseBundleExtras(XmlReader, Bundle)

Parse a series of LineSpacingExtra tags from an XML file.

SetHandle(IntPtr, JniHandleOwnership) SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
ToArray<T>() ToArray<T>() Inherited from Object
ToString() ToString()

Returns a string containing a concise, human-readable description of this object.

(Inherited from Object)
UnregisterFromRuntime() UnregisterFromRuntime() Inherited from Object
UpdateConfiguration(Configuration, DisplayMetrics) UpdateConfiguration(Configuration, DisplayMetrics)

Store the newly updated configuration.

Wait() Wait()

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.

(Inherited from Object)
Wait(Int64) Wait(Int64)

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the specified timeout expires.

(Inherited from Object)
Wait(Int64, Int32) Wait(Int64, Int32)

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the specified timeout expires.

(Inherited from Object)

Explicit Interface Implementations

IJavaObjectEx.ToLocalJniHandle() IJavaObjectEx.ToLocalJniHandle() Inherited from Object
IJavaPeerable.Disposed() IJavaPeerable.Disposed() Inherited from Object
IJavaPeerable.DisposeUnlessReferenced() IJavaPeerable.DisposeUnlessReferenced() Inherited from Object
IJavaPeerable.Finalized() IJavaPeerable.Finalized() Inherited from Object
IJavaPeerable.SetJniIdentityHashCode(Int32) IJavaPeerable.SetJniIdentityHashCode(Int32) Inherited from Object
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) Inherited from Object
IJavaPeerable.SetPeerReference(JniObjectReference) IJavaPeerable.SetPeerReference(JniObjectReference) Inherited from Object

Extension Methods

JavaCast<TResult>(IJavaObject) JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject) JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable) GetJniTypeName(IJavaPeerable)

Applies to