Compartilhar via


Thread.ContextClassLoader Property

Definition

Returns the context ClassLoader for this thread. -or- Sets the context ClassLoader for this Thread.

public virtual Java.Lang.ClassLoader? ContextClassLoader { [Android.Runtime.Register("getContextClassLoader", "()Ljava/lang/ClassLoader;", "GetGetContextClassLoaderHandler")] get; [Android.Runtime.Register("setContextClassLoader", "(Ljava/lang/ClassLoader;)V", "GetSetContextClassLoader_Ljava_lang_ClassLoader_Handler")] set; }
[<get: Android.Runtime.Register("getContextClassLoader", "()Ljava/lang/ClassLoader;", "GetGetContextClassLoaderHandler")>]
[<set: Android.Runtime.Register("setContextClassLoader", "(Ljava/lang/ClassLoader;)V", "GetSetContextClassLoader_Ljava_lang_ClassLoader_Handler")>]
member this.ContextClassLoader : Java.Lang.ClassLoader with get, set

Property Value

the context ClassLoader for this thread, or null indicating the system class loader (or, failing that, the bootstrap class loader)

Attributes

Remarks

Property getter documentation:

Returns the context ClassLoader for this thread. The context ClassLoader is provided by the creator of the thread for use by code running in this thread when loading classes and resources. If not #setContextClassLoader set, the default is the ClassLoader context of the parent thread. The context ClassLoader of the primordial thread is typically set to the class loader used to load the application.

Added in 1.2.

Java documentation for java.lang.Thread.getContextClassLoader().

Property setter documentation:

Sets the context ClassLoader for this Thread. The context ClassLoader can be set when a thread is created, and allows the creator of the thread to provide the appropriate class loader, through getContextClassLoader, to code running in the thread when loading classes and resources.

If a security manager is present, its SecurityManager#checkPermission(java.security.Permission) checkPermission method is invoked with a RuntimePermission RuntimePermission("setContextClassLoader") permission to see if setting the context ClassLoader is permitted.

Added in 1.2.

Java documentation for java.lang.Thread.setContextClassLoader(java.lang.ClassLoader).

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