Condividi tramite


AppComponentFactory.InstantiateClassLoader Method

Definition

Selects the class loader which will be used by the platform to instantiate app components.

[Android.Runtime.Register("instantiateClassLoader", "(Ljava/lang/ClassLoader;Landroid/content/pm/ApplicationInfo;)Ljava/lang/ClassLoader;", "GetInstantiateClassLoader_Ljava_lang_ClassLoader_Landroid_content_pm_ApplicationInfo_Handler", ApiSince=29)]
public virtual Java.Lang.ClassLoader InstantiateClassLoader (Java.Lang.ClassLoader cl, Android.Content.PM.ApplicationInfo aInfo);
[<Android.Runtime.Register("instantiateClassLoader", "(Ljava/lang/ClassLoader;Landroid/content/pm/ApplicationInfo;)Ljava/lang/ClassLoader;", "GetInstantiateClassLoader_Ljava_lang_ClassLoader_Landroid_content_pm_ApplicationInfo_Handler", ApiSince=29)>]
abstract member InstantiateClassLoader : Java.Lang.ClassLoader * Android.Content.PM.ApplicationInfo -> Java.Lang.ClassLoader
override this.InstantiateClassLoader : Java.Lang.ClassLoader * Android.Content.PM.ApplicationInfo -> Java.Lang.ClassLoader

Parameters

cl
ClassLoader

The default class loader created by the platform.

aInfo
ApplicationInfo

Information about the application being loaded.

Returns

Attributes

Remarks

Selects the class loader which will be used by the platform to instantiate app components.

The default implementation of this method returns the cl parameter unchanged. Applications can override this method to set up a custom class loader or a custom class loader hierarchy and return it to the platform.

The method is a hook invoked before any application components are instantiated or the application Context is initialized. It is intended to allow the application's classes to be loaded from a different source than the base/split APK(s).

The default class loader cl is created by the platform and used to load the application's base or split APK(s). Its parent is typically the boot class loader, unless running under instrumentation. Its classname is configurable using the android.R.attr#classLoader manifest attribute.

Java documentation for android.app.AppComponentFactory.instantiateClassLoader(java.lang.ClassLoader, android.content.pm.ApplicationInfo).

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