Udostępnij za pośrednictwem


Resources.OpenRawResource Method

Definition

Overloads

OpenRawResource(Int32)

Open a data stream for reading a raw resource.

OpenRawResource(Int32, TypedValue)

Open a data stream for reading a raw resource.

OpenRawResource(Int32)

Open a data stream for reading a raw resource.

[Android.Runtime.Register("openRawResource", "(I)Ljava/io/InputStream;", "GetOpenRawResource_IHandler")]
public virtual System.IO.Stream OpenRawResource (int id);
[<Android.Runtime.Register("openRawResource", "(I)Ljava/io/InputStream;", "GetOpenRawResource_IHandler")>]
abstract member OpenRawResource : int -> System.IO.Stream
override this.OpenRawResource : int -> System.IO.Stream

Parameters

id
Int32

The resource identifier to open, as generated by the aapt tool.

Returns

InputStream Access to the resource data.

Attributes

Exceptions

Throws NotFoundException if the given ID does not exist.

Remarks

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.

Java documentation for android.content.res.Resources.openRawResource(int).

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.

Applies to

OpenRawResource(Int32, TypedValue)

Open a data stream for reading a raw resource.

[Android.Runtime.Register("openRawResource", "(ILandroid/util/TypedValue;)Ljava/io/InputStream;", "GetOpenRawResource_ILandroid_util_TypedValue_Handler")]
public virtual System.IO.Stream OpenRawResource (int id, Android.Util.TypedValue? value);
[<Android.Runtime.Register("openRawResource", "(ILandroid/util/TypedValue;)Ljava/io/InputStream;", "GetOpenRawResource_ILandroid_util_TypedValue_Handler")>]
abstract member OpenRawResource : int * Android.Util.TypedValue -> System.IO.Stream
override this.OpenRawResource : int * Android.Util.TypedValue -> System.IO.Stream

Parameters

id
Int32

The resource identifier to open, as generated by the aapt tool.

value
TypedValue

The TypedValue object to hold the resource information.

Returns

InputStream Access to the resource data.

Attributes

Exceptions

Throws NotFoundException if the given ID does not exist.

Remarks

Open a data stream for reading a raw resource. This can only be used with resources whose value is the name of an asset file -- that is, it can be used to open drawable, sound, and raw resources; it will fail on string and color resources.

Java documentation for android.content.res.Resources.openRawResource(int, android.util.TypedValue).

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.

Applies to