public final class RxLifecycleAndroidLifecycle extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> com.trello.rxlifecycle2.LifecycleTransformer<T> |
bindLifecycle(Observable<android.arch.lifecycle.Lifecycle.Event> lifecycle)
Binds the given source to an Android lifecycle.
|
@NonNull @CheckResult public static <T> com.trello.rxlifecycle2.LifecycleTransformer<T> bindLifecycle(@NonNull Observable<android.arch.lifecycle.Lifecycle.Event> lifecycle)
This helper automatically determines (based on the lifecycle sequence itself) when the source should stop emitting items. In the case that the lifecycle sequence is in the creation phase (ON_CREATE, ON_START, etc) it will choose the equivalent destructive phase (ON_DESTROY, ON_STOP, etc). If used in the destructive phase, the notifications will cease at the next event; for example, if used in ON_PAUSE, it will unsubscribe in ON_STOP.
lifecycle - the lifecycle sequence of an ActivityLifecycleTransformer that unsubscribes the source during the Activity lifecycle