Save the date! Android Dev Summit is coming to Sunnyvale, CA on Oct 23-24, 2019.

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
open ContentProvider
instantiateProviderCompat(@NonNull cl: ClassLoader, @NonNull className: String)

Allows application to override the creation of providers.

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

Allows application to override the creation of services.

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

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

Allows application to override the creation of activities.

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

Allows application to override the creation of receivers.

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

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

Application!

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

Allows application to override the creation of the application object.

ContentProvider!

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

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.

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.

instantiateReceiver

fun instantiateReceiver(cl: ClassLoader!, className: String!, intent: Intent!): BroadcastReceiver!

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.

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.

instantiateActivity

fun instantiateActivity(cl: ClassLoader!, className: String!, intent: Intent!): Activity!

instantiateService

fun instantiateService(cl: ClassLoader!, className: String!, intent: Intent!): Service!

instantiateApplication

fun instantiateApplication(cl: ClassLoader!, 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

fun instantiateProvider(cl: ClassLoader!, className: String!): ContentProvider!