AppComponentFactory

Added in 1.1.0

@RequiresApi(value = 28)
class AppComponentFactory : 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

Public functions

Activity
instantiateActivity(cl: ClassLoader, className: String, intent: Intent?)
Activity
instantiateActivityCompat(
    cl: ClassLoader,
    className: String,
    intent: Intent?
)

Allows application to override the creation of activities.

Application
Application

Allows application to override the creation of the application object.

ContentProvider
ContentProvider

Allows application to override the creation of providers.

BroadcastReceiver
instantiateReceiver(cl: ClassLoader, className: String, intent: Intent?)
BroadcastReceiver
instantiateReceiverCompat(
    cl: ClassLoader,
    className: String,
    intent: Intent?
)

Allows application to override the creation of receivers.

Service
instantiateService(cl: ClassLoader, className: String, intent: Intent?)
Service
instantiateServiceCompat(
    cl: ClassLoader,
    className: String,
    intent: Intent?
)

Allows application to override the creation of services.

Public constructors

AppComponentFactory

Added in 1.1.0
AppComponentFactory()

Public functions

instantiateActivityCompat

Added in 1.1.0
fun instantiateActivityCompat(
    cl: ClassLoader,
    className: String,
    intent: Intent?
): Activity

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.

Parameters
cl: ClassLoader

The default classloader to use for instantiation.

className: String

The class to be instantiated.

intent: Intent?

Intent creating the class.

instantiateApplicationCompat

Added in 1.1.0
fun instantiateApplicationCompat(cl: ClassLoader, className: String): Application

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
cl: ClassLoader

The default classloader to use for instantiation.

className: String

The class to be instantiated.

instantiateProviderCompat

Added in 1.1.0
fun instantiateProviderCompat(cl: ClassLoader, className: String): ContentProvider

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
cl: ClassLoader

The default classloader to use for instantiation.

className: String

The class to be instantiated.

instantiateReceiverCompat

Added in 1.1.0
fun instantiateReceiverCompat(
    cl: ClassLoader,
    className: String,
    intent: Intent?
): BroadcastReceiver

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.

Parameters
cl: ClassLoader

The default classloader to use for instantiation.

className: String

The class to be instantiated.

intent: Intent?

Intent creating the class.

instantiateServiceCompat

Added in 1.1.0
fun instantiateServiceCompat(
    cl: ClassLoader,
    className: String,
    intent: Intent?
): Service

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.

Parameters
cl: ClassLoader

The default classloader to use for instantiation.

className: String

The class to be instantiated.

intent: Intent?

Intent creating the class.