The Android Developer Challenge is back! Submit your idea before December 2.

AppComponentFactory

open class AppComponentFactory : AppComponentFactory
kotlin.Any
   ↳ android.app.AppComponentFactory
   ↳ androidx.core.app.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

Version of android.app.AppComponentFactory that works with androidx libraries.

Public methods

Activity
instantiateActivity(@NonNull cl: ClassLoader, @NonNull className: String, @Nullable intent: Intent?)

open Activity
instantiateActivityCompat(@NonNull cl: ClassLoader, @NonNull className: String, @Nullable intent: Intent?)

Allows application to override the creation of activities.

Application
instantiateApplication(@NonNull cl: ClassLoader, @NonNull className: String)

open Application
instantiateApplicationCompat(@NonNull cl: ClassLoader, @NonNull className: String)

Allows application to override the creation of the application object.

ContentProvider
instantiateProvider(@NonNull cl: ClassLoader, @NonNull className: String)

open ContentProvider
instantiateProviderCompat(@NonNull cl: ClassLoader, @NonNull className: String)

Allows application to override the creation of providers.

BroadcastReceiver
instantiateReceiver(@NonNull cl: ClassLoader, @NonNull className: String, @Nullable intent: Intent?)

open BroadcastReceiver
instantiateReceiverCompat(@NonNull cl: ClassLoader, @NonNull className: String, @Nullable intent: Intent?)

Allows application to override the creation of receivers.

Service
instantiateService(@NonNull cl: ClassLoader, @NonNull className: String, @Nullable intent: Intent?)

open Service
instantiateServiceCompat(@NonNull cl: ClassLoader, @NonNull className: String, @Nullable intent: Intent?)

Allows application to override the creation of services.

Public constructors

<init>

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.

Public methods

instantiateActivity

@NonNull fun instantiateActivity(@NonNull cl: ClassLoader, @NonNull className: String, @Nullable intent: Intent?): Activity

instantiateActivityCompat

@NonNull open fun instantiateActivityCompat(@NonNull cl: ClassLoader, @NonNull className: String, @Nullable 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 ClassLoader: The class to be instantiated.
intent ClassLoader: Intent creating the class.

instantiateApplication

@NonNull fun instantiateApplication(@NonNull cl: ClassLoader, @NonNull className: String): Application

instantiateApplicationCompat

@NonNull open fun instantiateApplicationCompat(@NonNull cl: ClassLoader, @NonNull 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 ClassLoader: The class to be instantiated.

instantiateProvider

@NonNull fun instantiateProvider(@NonNull cl: ClassLoader, @NonNull className: String): ContentProvider

instantiateProviderCompat

@NonNull open fun instantiateProviderCompat(@NonNull cl: ClassLoader, @NonNull 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 ClassLoader: The class to be instantiated.

instantiateReceiver

@NonNull fun instantiateReceiver(@NonNull cl: ClassLoader, @NonNull className: String, @Nullable intent: Intent?): BroadcastReceiver

instantiateReceiverCompat

@NonNull open fun instantiateReceiverCompat(@NonNull cl: ClassLoader, @NonNull className: String, @Nullable 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 ClassLoader: The class to be instantiated.
intent ClassLoader: Intent creating the class.

instantiateService

@NonNull fun instantiateService(@NonNull cl: ClassLoader, @NonNull className: String, @Nullable intent: Intent?): Service

instantiateServiceCompat

@NonNull open fun instantiateServiceCompat(@NonNull cl: ClassLoader, @NonNull className: String, @Nullable 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 ClassLoader: The class to be instantiated.
intent ClassLoader: Intent creating the class.