Sdílet prostřednictvím


AppComponentFactory.InstantiateActivity(ClassLoader, String, Intent) Method

Definition

Allows application to override the creation of activities.

[Android.Runtime.Register("instantiateActivity", "(Ljava/lang/ClassLoader;Ljava/lang/String;Landroid/content/Intent;)Landroid/app/Activity;", "GetInstantiateActivity_Ljava_lang_ClassLoader_Ljava_lang_String_Landroid_content_Intent_Handler", ApiSince=28)]
public virtual Android.App.Activity InstantiateActivity (Java.Lang.ClassLoader cl, string className, Android.Content.Intent? intent);
[<Android.Runtime.Register("instantiateActivity", "(Ljava/lang/ClassLoader;Ljava/lang/String;Landroid/content/Intent;)Landroid/app/Activity;", "GetInstantiateActivity_Ljava_lang_ClassLoader_Ljava_lang_String_Landroid_content_Intent_Handler", ApiSince=28)>]
abstract member InstantiateActivity : Java.Lang.ClassLoader * string * Android.Content.Intent -> Android.App.Activity
override this.InstantiateActivity : Java.Lang.ClassLoader * string * Android.Content.Intent -> Android.App.Activity

Parameters

cl
ClassLoader

The default classloader to use for instantiation.

className
String

The class to be instantiated.

intent
Intent

Intent creating the class.

Returns

Attributes

Remarks

Allows application to override the creation of activities. This can be used to perform things such as dependency injection or class loader changes to these classes.

This method is only intended to provide a hook for instantiation. It does not provide earlier access to the Activity object. The returned object will not be initialized as a Context yet and should not be used to interact with other android APIs.

Java documentation for android.app.AppComponentFactory.instantiateActivity(java.lang.ClassLoader, java.lang.String, android.content.Intent).

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