Share via


ClassLoader.GetResource(String) Method

Definition

Finds the resource with the given name.

[Android.Runtime.Register("getResource", "(Ljava/lang/String;)Ljava/net/URL;", "GetGetResource_Ljava_lang_String_Handler")]
public virtual Java.Net.URL? GetResource (string? name);
[<Android.Runtime.Register("getResource", "(Ljava/lang/String;)Ljava/net/URL;", "GetGetResource_Ljava_lang_String_Handler")>]
abstract member GetResource : string -> Java.Net.URL
override this.GetResource : string -> Java.Net.URL

Parameters

name
String

The resource name

Returns

URL

URL object for reading the resource; null if the resource could not be found, a URL could not be constructed to locate the resource, the resource is in a package that is not opened unconditionally, or access to the resource is denied by the security manager.

Attributes

Remarks

Finds the resource with the given name. A resource is some data (images, audio, text, etc) that can be accessed by class code in a way that is independent of the location of the code.

The name of a resource is a '/'-separated path name thatf identifies the resource.

Added in 1.1.

Java documentation for java.lang.ClassLoader.getResource(java.lang.String).

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

See also