@Beta public final class AndroidInjection extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
inject(Activity activity)
Injects
activity if an associated AndroidInjector.Factory implementation can be
found, otherwise throws an IllegalArgumentException. |
static void |
inject(BroadcastReceiver broadcastReceiver,
Context context)
Injects
broadcastReceiver if an associated AndroidInjector.Factory
implementation can be found, otherwise throws an IllegalArgumentException. |
static void |
inject(Fragment fragment)
Injects
fragment if an associated AndroidInjector.Factory implementation can be
found, otherwise throws an IllegalArgumentException. |
static void |
inject(Service service)
Injects
service if an associated AndroidInjector.Factory implementation can be
found, otherwise throws an IllegalArgumentException. |
public static void inject(Activity activity)
activity if an associated AndroidInjector.Factory implementation can be
found, otherwise throws an IllegalArgumentException.RuntimeException - if the Application doesn't implement HasDispatchingActivityInjector, or if no AndroidInjector.Factory<? extends
Activity> is bound for activity.public static void inject(Fragment fragment)
fragment if an associated AndroidInjector.Factory implementation can be
found, otherwise throws an IllegalArgumentException.
Uses the following algorithm to find the appropriate DispatchingAndroidInjector<Fragment> to inject fragment:
HasDispatchingFragmentInjector, and if none do
fragment's activity if it implements
HasDispatchingFragmentInjector, and if not
Application if it implements HasDispatchingFragmentInjector.
HasDispatchingFragmentInjector, a IllegalArgumentException is thrown.IllegalArgumentException - if no AndroidInjector.Factory<? extends Fragment> is
bound for fragment.public static void inject(Service service)
service if an associated AndroidInjector.Factory implementation can be
found, otherwise throws an IllegalArgumentException.RuntimeException - if the Application doesn't implement HasDispatchingServiceInjector, or if no AndroidInjector.Factory<? extends Service>
is bound for service.public static void inject(BroadcastReceiver broadcastReceiver, Context context)
broadcastReceiver if an associated AndroidInjector.Factory
implementation can be found, otherwise throws an IllegalArgumentException.RuntimeException - if the Application from Context.getApplicationContext() doesn't implement HasDispatchingBroadcastReceiverInjector, or if no AndroidInjector.Factory<? extends
BroadcastReceiver> is bound for broadcastReceiver.Copyright © 2012���2017 The Dagger Authors. All rights reserved.