@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
or HasActivityInjector
.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
to use to
inject fragment
:
HasAndroidInjector
or HasFragmentInjector
, and if none do
fragment
's activity
if it implements
HasAndroidInjector
or HasFragmentInjector
, and if not
Application
if it implements HasAndroidInjector
HasFragmentInjector
.
HasAndroidInjector
or HasFragmentInjector
, a IllegalArgumentException
is thrown.java.lang.IllegalArgumentException
- if no parent fragment, activity, or application implements
HasAndroidInjector
or HasFragmentInjector
.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
or HasServiceInjector
.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
or HasBroadcastReceiverInjector
.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
or HasContentProviderInjector
.