Skip to content
Advertisement

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 onSuccess method will be called and inside this

What is the meaning of flatmap( return Observer::onComplete;) in rxJava? And why is the return type of it is Observerable?

I cannot understand the line of return Observer::onComplete; Answer It’s a fancy and incorrect way of doing an empty result รก la Observable.empty(). fatMapObservable expects an Observable<POJO> as its return due to target typing. Since Observable is a single abstract method type, you can use a lambda expression to construct an instance of it. I.e., have the subscribe(Observer<POJO>) method implemented

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? Answer Since Flowable supports backpressure you have to

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 onComplete(). By the time that you call dispose(), the observable is done, and nothing will

Difference between CompletableFuture, Future and RxJava’s Observable

I would like to know the difference between CompletableFuture,Future and Observable RxJava. What I know is all are asynchronous but Future.get() blocks the thread CompletableFuture gives the callback methods RxJava Observable — similar to CompletableFuture with other benefits(not sure) For example: if client needs to make multiple service calls and when we use Futures (Java) Future.get() will be executed sequentially…would

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 Observable.just(1,2,3,4,5,6,7,8,-1,-2) is ok but Observable.just(1,2,3,4,5,6,7,8,-1,-2,-3)

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 propagate down the stream. onNext is more final, it

Advertisement