added in version 1.0.0
belongs to Maven artifact androidx.core:core:1.0.0-beta01

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

added in version 1.0.0
public AppComponentFactory ()

Public methods

instantiateActivity

added in version 1.0.0
public final Activity instantiateActivity (ClassLoader cl, 
                String className, 
                Intent intent)

Parameters
cl ClassLoader

className String

intent Intent

Returns
Activity

Throws
InstantiationException
IllegalAccessException
ClassNotFoundException

instantiateActivityCompat

added in version 1.0.0
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

added in version 1.0.0
public final Application instantiateApplication (ClassLoader cl, 
                String className)

Parameters
cl ClassLoader

className String

Returns
Application

Throws
InstantiationException
IllegalAccessException
ClassNotFoundException

instantiateApplicationCompat

added in version 1.0.0
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

added in version 1.0.0
public final ContentProvider instantiateProvider (ClassLoader cl, 
                String className)

Parameters
cl ClassLoader

className String

Returns
ContentProvider

Throws
InstantiationException
IllegalAccessException
ClassNotFoundException

instantiateProviderCompat

added in version 1.0.0
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

added in version 1.0.0
public final BroadcastReceiver instantiateReceiver (ClassLoader cl, 
                String className, 
                Intent intent)

Parameters
cl ClassLoader

className String

intent Intent

Returns
BroadcastReceiver

Throws
InstantiationException
IllegalAccessException
ClassNotFoundException

instantiateReceiverCompat

added in version 1.0.0
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

added in version 1.0.0
public final Service instantiateService (ClassLoader cl, 
                String className, 
                Intent intent)

Parameters
cl ClassLoader

className String

intent Intent

Returns
Service

Throws
InstantiationException
IllegalAccessException
ClassNotFoundException

instantiateServiceCompat

added in version 1.0.0
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