Questions tagged [rx-java2]

anything related to RxJava2 – The new implementation of the RxJava Reactive Extensions for the JVM – a library for composing asynchronous and event-based programs using observable sequences for the Java VM.

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

It extends the observer pattern to support sequences of data/events and adds operators that allow you to compose sequences together declaratively while abstracting away concerns about things like low-level threading, synchronization, thread-safety and concurrent data structures.

4140 questions
1
vote
0 answers

Real Life Retrofit use cases with FlatMap and SwitchMap using a Subject or RXRelay

There are a lot of great posts and articles explaining FlatMap and SwitchMap, but I am asking here concrete complex real life with examples on how to use FlatMap and SwitchMap with Retrofit using a Subject or RXRelay, so to add a level of…
Drocchio
  • 383
  • 4
  • 21
1
vote
1 answer

Handle server delay showing ProgresBar using RXJAVA

I would like to implement ProgressBar for my server delay. I am based on : Consuming REST API using Retrofit Library with the help of MVVM, Dagger 2, LiveData and RxJava 2 in…
htw
  • 1,065
  • 7
  • 11
1
vote
3 answers

How to cancel a call with RxJava2?

I'm using RxJava2 and Retrofit. In my fragment, I make a request to upload a local file: Disposable disposable = mApi.requestUpload(file) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) …
Ebn Zhang
  • 241
  • 2
  • 9
1
vote
1 answer

Retrofit + Debouce on EditText is causing an InterruptedIOException

I currently have an EditText for the user to enter a search. I'm trying to use RxJava with debounce to only search every so often, instead of each character. However, I'm getting an InterruptedIOException while I'm testing, which kills the…
advice
  • 5,778
  • 10
  • 33
  • 60
1
vote
2 answers

RxJava Combining Multiple Observer after filter

Following is my Current Code private final List subscriptions = new ArrayList<>(); for (Instrument instrument : instruments) { // Waiting for OrderBook to generate Reliable results. GenericBook Book = service …
1
vote
1 answer

File text change detection with rxjava

I want to implement some code that detect any file change (txt, doc, pdf etc.) to trigger some task with RXJava. Is it possible? Any suggestion? Thanks in advance.
Vitto Lib
  • 55
  • 1
  • 1
  • 9
1
vote
1 answer

How to properly implement camera2 realtime frame processing using RxJava?

I'm making reactive wrapper over camera2, my goal is to get each frame and then pass to face recognition. So, I created a wrapper method over setOnImageAvailableListener fun createOnImageAvailableFlowable(imageReader: ImageReader, handler:…
trueangle
  • 230
  • 2
  • 12
1
vote
2 answers

Rxjava2 - how to emit onNext() right away before observable sequence completes

I have two observables that are chained together in a flatMap like this: override fun getProductObservable(): Observable> { return observable1(productId) .flatMap({ val limit = 8 - it.size …
j2emanue
  • 60,549
  • 65
  • 286
  • 456
1
vote
1 answer

Android Adapter formats layout before onDataSetChanged has had time to process the data

I'm implementing an instance of RemoteViewsService.RemoteViewsFactory which controls the layout for my widget. The problem is the data to format the layouts gets pulled from the database and formatted asynchronously via RxJava2. @Override public…
Maruf
  • 890
  • 3
  • 10
  • 21
1
vote
1 answer

How to use Single vs Observables

I created an example to see the difference between Single and Observable. the below posted example does not work. Also I can't see any difference between Observable and Single. How do the below examples work? Code: public static void main(String[]…
Amrmsmb
  • 1
  • 27
  • 104
  • 226
1
vote
0 answers

Problem with notification via broadcast recevier and rxJava2

I got a problem with notification in the broadcast receiver. Here's Class: public class JokeAlarmReceiver extends BroadcastReceiver { CompositeDisposable compositeDisposable = new CompositeDisposable(); public static final String…
1
vote
0 answers

How to use forEach with observables

As shown below, I am learning how to use rxjava. I want to know how to use foreach with observables. the problem is, when i use forEach i receive compilation error: add cast to method receiver please let me know how to use forEach correctly. thanks…
Amrmsmb
  • 1
  • 27
  • 104
  • 226
1
vote
1 answer

RxJava's retryWhen operator

I'm trying to understand retryWhen operator in depth and I have some code as below. Flowable.just(1, 2, 3, 4, 5) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .retryWhen { throwable…
Berry Huang
  • 23
  • 1
  • 4
1
vote
1 answer

How can I synchronously subscribe to an observable so that I don't miss out on emissions from that observable?

I have an android app with an MVVM architecture. The view layer ( a fragment ) subscribes to an observable that is exposed by the ViewModel in the onStart(). Right after I call subscribe() on that observable, I make a direct invocation on the…
Tyler Pfaff
  • 4,900
  • 9
  • 47
  • 62
1
vote
1 answer

How to make Files.lines AutoCloseable in Flowable.generate

I have the following snippet and it generates Flowable. I'm not sure how can I make the Files.lines Autoclosable. I needed to pass in iterator as the second argument to read line one by one as its consumed. Please note that I have not used…
Panch
  • 1,097
  • 3
  • 12
  • 43