Skip to content

Tag: rx-java

Can I delay the onSuccess method in RxJava?

I have SplashScreenFragment and inside this fragment, I’ll load the data from the server using Retrofit with RxJava, Getting data from the server will take between 1 second to 25 seconds. The SplashScreenFragment must show to the user for at least 8 seconds. When I get the data from the server, The onSu…

RxJava3. Why FlowableSubscriber onNext has not been called?

I need to get a Subscription object to have an opportunity of unsubscribing listeners. For this I want to give a FlowableSubscriber to function. Code: Logs are: If I use lambdas it works, but there is not onSubscribe callback. How can I get a subscription and why these mathods haven’t been called? Answe…

Why is doOnDispose not called?

When creating an Observable like this: doOnSubcribe is called, doOnDispose is not called. Why is that? Answer You need to use the doFinally() operator. doOnDispose() has a very narrow use case, where the observable is explicitly disposed. In your example, the observable terminates “naturally” by o…

RxJava – Just vs From

I’m getting the same output when using Observable.just vs Observable.from in the following case: I thought just was just supposed to emit a single item and from was to emit items in some sort of list. Whats the difference ? I also noted that just and from take only a limited amount of arguments. So Obse…

What is the purpose of doOnNext(…) in RxJava

When should we use doOnNext() from Observable instead of just onNext()? Answer doOnNext is for side-effects: you want to react (eg. log) to item emissions in an intermediate step of your stream, for example before the stream is filtered, for transverse behavior like logging, but you still want the value to pr…