Android Guides | Samples

Android.Content.Res.Resources.OpenRawResource Method

Open a data stream for reading a raw resource.

Syntax

[Android.Runtime.Register("openRawResource", "(ILandroid/util/TypedValue;)Ljava/io/InputStream;", "GetOpenRawResource_ILandroid_util_TypedValue_Handler")]
public virtual Stream OpenRawResource (Int32 id, TypedValue value)

Parameters

id
The resource identifier to open, as generated by the appt tool.
value
The TypedValue object to hold the resource information.

Exceptions

TypeReason
!:NoType:android/content/res/Resources$NotFoundException;Href=../../../../reference/android/content/res/Resources.NotFoundException.htmlThrows 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.

[Android Documentation]

Requirements

Namespace: Android.Content.Res
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 3