AppComponentFactory

public class AppComponentFactory
extends AppComponentFactory

java.lang.Object
   ↳ android.app.AppComponentFactory
     ↳ androidx.core.app.AppComponentFactory


Version of AppComponentFactory that works with androidx libraries. Note: This will only work on API 28+ and does not backport AppComponentFactory functionality.

Summary

Public constructors

AppComponentFactory()

Public methods

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

Allows application to override the creation of activities.

final Application instantiateApplication(ClassLoader cl, String className)
Application instantiateApplicationCompat(ClassLoader cl, String className)

Allows application to override the creation of the application object.

final ContentProvider instantiateProvider(ClassLoader cl, String className)
ContentProvider instantiateProviderCompat(ClassLoader cl, String className)

Allows application to override the creation of providers.

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

Allows application to override the creation of receivers.

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

Allows application to override the creation of services.

Inherited methods

Public constructors

AppComponentFactory

public AppComponentFactory ()

Public methods

instantiateActivity

public final Activity instantiateActivity (ClassLoader cl, 
                String className, 
                Intent intent)

Parameters
cl ClassLoader

className String

intent Intent

Returns
Activity

Throws
InstantiationException
IllegalAccessException
ClassNotFoundException

instantiateActivityCompat

public Activity instantiateActivityCompat (ClassLoader cl, 
                String className, 
                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.

Parameters
cl ClassLoader: The default classloader to use for instantiation.

className String: The class to be instantiated.

intent Intent: Intent creating the class.

Returns
Activity

Throws
InstantiationException
IllegalAccessException
ClassNotFoundException

instantiateApplication

public final Application instantiateApplication (ClassLoader cl, 
                String className)

Parameters
cl ClassLoader

className String

Returns
Application

Throws
InstantiationException
IllegalAccessException
ClassNotFoundException

instantiateApplicationCompat

public Application instantiateApplicationCompat (ClassLoader cl, 
                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
cl ClassLoader: The default classloader to use for instantiation.

className String: The class to be instantiated.

Returns
Application

Throws
InstantiationException
IllegalAccessException
ClassNotFoundException

instantiateProvider

public final ContentProvider instantiateProvider (ClassLoader cl, 
                String className)

Parameters
cl ClassLoader

className String

Returns
ContentProvider

Throws
InstantiationException
IllegalAccessException
ClassNotFoundException

instantiateProviderCompat

public ContentProvider instantiateProviderCompat (ClassLoader cl, 
                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
cl ClassLoader: The default classloader to use for instantiation.

className String: The class to be instantiated.

Returns
ContentProvider

Throws
InstantiationException
IllegalAccessException
ClassNotFoundException

instantiateReceiver

public final BroadcastReceiver instantiateReceiver (ClassLoader cl, 
                String className, 
                Intent intent)

Parameters
cl ClassLoader

className String

intent Intent

Returns
BroadcastReceiver

Throws
InstantiationException
IllegalAccessException
ClassNotFoundException

instantiateReceiverCompat

public BroadcastReceiver instantiateReceiverCompat (ClassLoader cl, 
                String className, 
                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.

Parameters
cl ClassLoader: The default classloader to use for instantiation.

className String: The class to be instantiated.

intent Intent: Intent creating the class.

Returns
BroadcastReceiver

Throws
InstantiationException
IllegalAccessException
ClassNotFoundException

instantiateService

public final Service instantiateService (ClassLoader cl, 
                String className, 
                Intent intent)

Parameters
cl ClassLoader

className String

intent Intent

Returns
Service

Throws
InstantiationException
IllegalAccessException
ClassNotFoundException

instantiateServiceCompat

public Service instantiateServiceCompat (ClassLoader cl, 
                String className, 
                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.

Parameters
cl ClassLoader: The default classloader to use for instantiation.

className String: The class to be instantiated.

intent Intent: Intent creating the class.

Returns
Service

Throws
InstantiationException
IllegalAccessException
ClassNotFoundException