Nyelv

ClassLoader.LoadClass Method

Definition

Overloads

Name Description
LoadClass(String)

Loads the class with the specified binary name.

LoadClass(String, Boolean)

Loads the class with the specified binary name.

LoadClass(String)

Loads the class with the specified binary name.

[Android.Runtime.Register("loadClass", "(Ljava/lang/String;)Ljava/lang/Class;", "GetLoadClass_Ljava_lang_String_Handler")]
public virtual Java.Lang.Class? LoadClass(string? name);
[<Android.Runtime.Register("loadClass", "(Ljava/lang/String;)Ljava/lang/Class;", "GetLoadClass_Ljava_lang_String_Handler")>]
abstract member LoadClass : string -> Java.Lang.Class
override this.LoadClass : string -> Java.Lang.Class

Parameters

name
String

The binary name of the class

Returns

The resulting Class object

Attributes

Exceptions

if the class can not be found.

Remarks

Loads the class with the specified binary name. This method searches for classes in the same manner as the #loadClass(String, boolean) method. It is invoked by the Java virtual machine to resolve class references. Invoking this method is equivalent to invoking #loadClass(String, boolean) loadClass(name, false).

Java documentation for java.lang.ClassLoader.loadClass(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

LoadClass(String, Boolean)

Loads the class with the specified binary name.

[Android.Runtime.Register("loadClass", "(Ljava/lang/String;Z)Ljava/lang/Class;", "GetLoadClass_Ljava_lang_String_ZHandler")]
protected virtual Java.Lang.Class? LoadClass(string? name, bool resolve);
[<Android.Runtime.Register("loadClass", "(Ljava/lang/String;Z)Ljava/lang/Class;", "GetLoadClass_Ljava_lang_String_ZHandler")>]
abstract member LoadClass : string * bool -> Java.Lang.Class
override this.LoadClass : string * bool -> Java.Lang.Class

Parameters

name
String

The binary name of the class

resolve
Boolean

If true, the caller requests class resolution. The Android base implementation ignores this value.

Returns

The resulting Class object

Attributes

Exceptions

if the class can not be found.

Remarks

Loads the class with the specified binary name. The default implementation of this method searches for classes in the following order:

<ol>

<li>

Invoke #findLoadedClass(String) to check if the class has already been loaded.

</li>

<li>

Invoke the #loadClass(String) loadClass method on the parent class loader. If the parent is null the class loader built into the virtual machine is used, instead.

</li>

<li>

Invoke the #findClass(String) method to find the class.

</li>

</ol>

The Android base implementation ignores the resolve flag and does not call #resolveClass(Class). It returns the Class object found by the above steps.

Subclasses of ClassLoader are encouraged to override #findClass(String), rather than this method.

Java documentation for java.lang.ClassLoader.loadClass(java.lang.String, boolean).

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