Android Guides | Samples

Java.Lang.Class.ForName Method

Returns a Class object which represents the class with the given name.

Syntax

[Android.Runtime.Register("forName", "(Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class;", "")]
public static Class ForName (String className, Boolean initializeBoolean, ClassLoader classLoader)

Parameters

className
shouldInitialize
classLoader

Exceptions

TypeReason
ClassNotFoundExceptionif the requested class cannot be found.
LinkageErrorif an error occurs during linkage
ExceptionInInitializerErrorif an exception occurs during static initialization of a class.

Remarks

Returns a Class object which represents the class with the given name. The name should be the name of a non-primitive class, as described in the Class. Primitive types can not be found using this method; use int.class or Integer.TYPE instead.

If the class has not yet been loaded, it is loaded first, using the given class loader. If the class has not yet been initialized and shouldInitialize is true, the class will be initialized.

If the provided classLoader is null, the bootstrap class loader will be used to load the class.

[Android Documentation]

Requirements

Namespace: Java.Lang
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1