Compartir a través de


ClassLoader.LoadClass Method

Definition

Overloads

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) <tt>loadClass(name, false)</tt>.

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 then resolve 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. 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) <tt>loadClass</tt> method on the parent class loader. If the parent is null the class loader built-in to the virtual machine is used, instead.

</li>

<li>

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

</li>

</ol>

If the class was found using the above steps, and the resolve flag is true, this method will then invoke the #resolveClass(Class) method on the resulting Class object.

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