@Beta
public final class AndroidInjection
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
inject(android.app.Activity activity)
Injects
activity if an associated AndroidInjector implementation can be found,
otherwise throws an IllegalArgumentException . |
static void |
inject(android.content.BroadcastReceiver broadcastReceiver,
android.content.Context context)
Injects
broadcastReceiver if an associated AndroidInjector implementation can
be found, otherwise throws an IllegalArgumentException . |
static void |
inject(android.content.ContentProvider contentProvider)
Injects
contentProvider if an associated AndroidInjector implementation can be
found, otherwise throws an IllegalArgumentException . |
static void |
inject(android.app.Fragment fragment)
Injects
fragment if an associated AndroidInjector implementation can be found,
otherwise throws an IllegalArgumentException . |
static void |
inject(android.app.Service service)
Injects
service if an associated AndroidInjector implementation can be found,
otherwise throws an IllegalArgumentException . |
public static void inject(android.app.Activity activity)
activity
if an associated AndroidInjector
implementation can be found,
otherwise throws an IllegalArgumentException
.java.lang.RuntimeException
- if the Application
doesn't implement HasAndroidInjector
.public static void inject(android.app.Fragment fragment)
fragment
if an associated AndroidInjector
implementation can be found,
otherwise throws an IllegalArgumentException
.
Uses the following algorithm to find the appropriate AndroidInjector<Fragment>
to
use to inject fragment
:
HasAndroidInjector
, and if none do
fragment
's activity
if it implements
HasAndroidInjector
, and if not
Application
if it implements HasAndroidInjector
.
HasAndroidInjector
, a IllegalArgumentException
is
thrown.java.lang.IllegalArgumentException
- if no parent fragment, activity, or application implements
HasAndroidInjector
.public static void inject(android.app.Service service)
service
if an associated AndroidInjector
implementation can be found,
otherwise throws an IllegalArgumentException
.java.lang.RuntimeException
- if the Application
doesn't implement HasAndroidInjector
.public static void inject(android.content.BroadcastReceiver broadcastReceiver, android.content.Context context)
broadcastReceiver
if an associated AndroidInjector
implementation can
be found, otherwise throws an IllegalArgumentException
.java.lang.RuntimeException
- if the Application
from Context.getApplicationContext()
doesn't implement HasAndroidInjector
.public static void inject(android.content.ContentProvider contentProvider)
contentProvider
if an associated AndroidInjector
implementation can be
found, otherwise throws an IllegalArgumentException
.java.lang.RuntimeException
- if the Application
doesn't implement HasAndroidInjector
.