Questions tagged [rx-java]

RxJava – Reactive Extensions for the JVM – a library for composing asynchronous and event-based programs using observable sequences for the Java VM.

RxJava is a Java implementation of Reactive Extensions. Android-specific support for RxJava is provided by .

The main goals of RxJava

  • Stay true to the principles and concepts behind the original implementation while adjusting to the naming conventions and idioms of Java
  • All contracts of Rx should be the same target - the JVM
  • JVM-based languages supported (beyond Java itself) include , , , and
  • Support Java 6+

The library is open sourced under Apache 2.0 license.

References

6958 questions
39
votes
4 answers

EventBus/PubSub vs (reactive extensions) RX with respect to code clarity in a single threaded application

Currently, I am using an EventBus/PubSub architecture/pattern with Scala (and JavaFX) to implement a simple note organizing app (sort of like an Evernote client with some added mind mapping functionality) and I have to say that I really like…
39
votes
3 answers

How can PublishSubject and BehaviorSubject be unsubscribed from?

Under the subjects package you have classes like PublishSubject and BehaviorSubject which I suppose can be described as some usable sample Observables. How can these subjects be unsubscribed from? There is no unsubscribe method and calling…
arinte
  • 3,660
  • 10
  • 45
  • 65
38
votes
4 answers

Replace callbacks with observables from RxJava

Im using listeners as callbacks to observe asynchronous operations with Android, but I think that could be great replacing this listeners with RxJava, Im new using this library but I really like it and Im always using it with Android projects. Here…
Pablo Cegarra
  • 20,955
  • 12
  • 92
  • 110
38
votes
2 answers

Do I have to unsubscribe from completed observable?

If an observable completes, do I still have to unsubscribe / dispose (in RxJava2) the observable to remove the Observer (prevent memory leaks) or is this handled internally by RxJava once a onComplete or onError event occurs? what about other types…
sockeqwe
  • 15,574
  • 24
  • 88
  • 144
38
votes
5 answers

IllegalArgumentException: Could not locate call adapter for rx.Observable RxJava, Retrofit2

I am getting the above error while calling the rest api. I am using both retrofit2 and RxJava. ServiceFactory.java public class ServiceFactory { public static T createRetrofitService(final Class clazz, final String endpoint){ Retrofit…
Hemendra Sethi
  • 383
  • 1
  • 3
  • 5
38
votes
4 answers

Split Rx Observable into multiple streams and process individually

Here is a picture of what I am attempting to accomplish. --a-b-c-a--bbb--a split into --a-----a-------a --> a stream ----b------bbb--- --> b stream ------c---------- --> c stream Then, be able to a.subscribe() b.subscribe() c.subscribe() So…
Brandon Bil
  • 405
  • 1
  • 5
  • 8
37
votes
6 answers

How to reset a BehaviorSubject

I have a BehaviorSubject that I would like to reset - by that I mean I want the latest value to not be available, just as if it was just created. I don't seem to see an API to do this but I suppose there is another way to achieve the same result? My…
BoD
  • 10,838
  • 6
  • 63
  • 59
36
votes
0 answers

Android Room Exceptions

What kinds of exceptions I should consider while working with Android Room. From my research I found out that there is only one exception that might occur. Room Exceptions That is also when you are having Single as a return type and you have an…
musooff
  • 6,412
  • 3
  • 36
  • 65
36
votes
1 answer

What is the difference between Observable and Flowable in RxJava 2.0?

Observable and Flowable interfaces seem to be identical. Why Flowable was introduced in RxJava 2.0? When should I prefer to use Flowable over Observable?
x2bool
  • 2,766
  • 5
  • 26
  • 33
36
votes
3 answers

Android Rxjava subscribe to a variable change

I am learning Observer pattern, I want my observable to keep track of a certain variable when it changes it's value and do some operations, I've done something like : public class Test extends MyChildActivity { private int VARIABLE_TO_OBSERVE =…
Karate_Dog
  • 1,265
  • 5
  • 20
  • 37
36
votes
2 answers

Difference between first() and take(1)

I am trying to understand the details of RxJava. Intuitively I expected first() and take(1) to be equal and do the same. However by digging in the source code first() is defined as take(1).single(). What is the single() here good for? Doesn't…
Paul Woitaschek
  • 6,717
  • 5
  • 33
  • 52
36
votes
2 answers

What is the difference between Schedulers.io() and Schedulers.computation()

I use Observables in couchbase. What is the difference between Schedulers.io() and Schedulers.computation()?
Osama Abdulsattar
  • 576
  • 1
  • 4
  • 11
34
votes
5 answers

RxJava Combine Sequence Of Requests

The Problem I have two Apis. Api 1 gives me a List of Items and Api 2 gives me more detailed Information for each of the items I got from Api 1. The way I solved it so far results in bad Performance. The Question Efficent and fast solution to this…
Mayr Technologies
  • 725
  • 3
  • 10
  • 19
34
votes
2 answers

Is there something like Single.empty()

I'm in the process of migrating from Rx 1 to Rx 2 and suddenly while reading through posts I found out that Single should be the type of observable to use for retrofit calls. So I've decided to give it a shot and while migrating our retrofit calls…
Fred
  • 16,367
  • 6
  • 50
  • 65
34
votes
5 answers

How to convert rxJava2's Observable to Completable?

I have Observable stream, and I want to convert it to Completable, how I could do that?
Stepango
  • 4,721
  • 3
  • 31
  • 44