rx-android
Get the latest value of an Observable and emit it immeditely
last() method will not be of any help here as it waits for the Observable to terminate to give you the last item emitted. Assuming that you do not have the control over the emitting observable you could simply create a BehaviorSubject and subscribe it to the observable that emits the data that you want … Read more
RxJava flatMapIterable with a Single
flattenAsObservable should do the trick, it will map Single success value to Iterable (list), and emit each item of the list as an Observable. getListOfItems() .flattenAsObservable(new Function<Object, Iterable<?>>() { @Override public Iterable<?> apply(@NonNull Object o) throws Exception { return toItems(o); } }) .flatMap(item -> doSomethingWithItem()) .toList()
Use RxAndroid or RxKotlin when programming in Kotlin for Android? [closed]
You could use both of them. RxKotlin contains an extension functions that provides to you idiomatic way(with writing less code) of using rxJava in Kotlin. rxAndroid(is now split in few libraries) provides specific platform bindings such as: rxAndroid that could help you to manage an execution with native android Handlers rxLifecycle that provides Activity lifecycle … Read more
Android RX – Observable.timer only firing once
The documentation for the timer operator says this: Create an Observable that emits a particular item after a given delay Thus the behavior you are observing is expected- timer() emits just a single item after a delay. The interval operator, on the other hand, will emit items spaced out with a given interval. For example, … Read more
How do I get Response body when there is an error when using Retrofit 2.0 Observables
Just check if the throwable is an instance of HttpException and then you can access the retrofit response if (e instanceof HttpException) { ResponseBody body = ((HttpException) e).response().errorBody(); … } Then you can use the converter to deserialize it (or do it yourself).