AppComponentFactory
@RequiresApi(value = 28)
public class AppComponentFactory extends AppComponentFactory
Version of android.app.AppComponentFactory that works with androidx libraries. Note: This will only work on API 28+ and does not backport AppComponentFactory functionality.
Summary
Public constructors |
|---|
Inherited methods |
|---|
Public constructors
Public methods
instantiateActivity
public final @NonNull Activity instantiateActivity(
@NonNull ClassLoader cl,
@NonNull String className,
@Nullable Intent intent
)
| Throws | |
|---|---|
java.lang.InstantiationException |
|
java.lang.IllegalAccessException |
|
java.lang.ClassNotFoundException |
| See also | |
|---|---|
instantiateActivityCompat |
instantiateActivityCompat
public @NonNull Activity instantiateActivityCompat(
@NonNull ClassLoader cl,
@NonNull String className,
@Nullable Intent intent
)
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.
instantiateApplication
public final @NonNull Application instantiateApplication(@NonNull ClassLoader cl, @NonNull String className)
| Throws | |
|---|---|
java.lang.InstantiationException |
|
java.lang.IllegalAccessException |
|
java.lang.ClassNotFoundException |
| See also | |
|---|---|
instantiateApplicationCompat |
instantiateApplicationCompat
public @NonNull Application instantiateApplicationCompat(
@NonNull ClassLoader cl,
@NonNull String className
)
Allows application to override the creation of the application object. 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 Application object. The returned object will not be initialized as a Context yet and should not be used to interact with other android APIs.
| Parameters | |
|---|---|
@NonNull ClassLoader cl |
The default classloader to use for instantiation. |
@NonNull String className |
The class to be instantiated. |
instantiateProvider
public final @NonNull ContentProvider instantiateProvider(@NonNull ClassLoader cl, @NonNull String className)
| Throws | |
|---|---|
java.lang.InstantiationException |
|
java.lang.IllegalAccessException |
|
java.lang.ClassNotFoundException |
| See also | |
|---|---|
instantiateProviderCompat |
instantiateProviderCompat
public @NonNull ContentProvider instantiateProviderCompat(
@NonNull ClassLoader cl,
@NonNull String className
)
Allows application to override the creation of providers. 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 ContentProvider object. The returned object will not be initialized with a Context yet and should not be used to interact with other android APIs.
| Parameters | |
|---|---|
@NonNull ClassLoader cl |
The default classloader to use for instantiation. |
@NonNull String className |
The class to be instantiated. |
instantiateReceiver
public final @NonNull BroadcastReceiver instantiateReceiver(
@NonNull ClassLoader cl,
@NonNull String className,
@Nullable Intent intent
)
| Throws | |
|---|---|
java.lang.InstantiationException |
|
java.lang.IllegalAccessException |
|
java.lang.ClassNotFoundException |
| See also | |
|---|---|
instantiateReceiverCompat |
instantiateReceiverCompat
public @NonNull BroadcastReceiver instantiateReceiverCompat(
@NonNull ClassLoader cl,
@NonNull String className,
@Nullable Intent intent
)
Allows application to override the creation of receivers. This can be used to perform things such as dependency injection or class loader changes to these classes.
instantiateService
public final @NonNull Service instantiateService(
@NonNull ClassLoader cl,
@NonNull String className,
@Nullable Intent intent
)
| Throws | |
|---|---|
java.lang.InstantiationException |
|
java.lang.IllegalAccessException |
|
java.lang.ClassNotFoundException |
| See also | |
|---|---|
instantiateServiceCompat |
instantiateServiceCompat
public @NonNull Service instantiateServiceCompat(
@NonNull ClassLoader cl,
@NonNull String className,
@Nullable Intent intent
)
Allows application to override the creation of services. 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 Service object. The returned object will not be initialized as a Context yet and should not be used to interact with other android APIs.