Questions tagged [rx-android]

RxJava bindings for Android

specific bindings for . RxAndroid module adds a number of classes to RxJava that make writing reactive components in Android applications easy and hassle free.

RxAndroid is open sourced and available under the Apache License, Version 2.0


Related tags

1768 questions
257
votes
3 answers

Use cases for RxJava schedulers

In RxJava there are 5 different schedulers to choose from: immediate(): Creates and returns a Scheduler that executes work immediately on the current thread. trampoline(): Creates and returns a Scheduler that queues work on the current thread to…
bcorso
  • 45,608
  • 10
  • 63
  • 75
229
votes
11 answers

When to use RxJava in Android and when to use LiveData from Android Architectural Components?

I am not getting the reason to use RxJava in Android and LiveData from Android Architectural Components.It would be really helpful if the usecases and differences between the both are explained along with sample example in the form of code which…
121
votes
3 answers

Get response status code using Retrofit 2.0 and RxJava

I'm trying to upgrade to Retrofit 2.0 and add RxJava in my android project. I'm making an api call and want to retrieve the error code in case of an error response from the server. Observable apiCall(@Body body); And in the…
A.B.
  • 1,441
  • 3
  • 12
  • 10
112
votes
4 answers

Unable to create call adapter for io.reactivex.Observable

I'm going to send a simple get method to my server(it is Rails app) and get the result using RxJava and Retrofit. The thing that I did is: My interface: public interface ApiCall { String SERVICE_ENDPOINT = "https://198.50.214.15"; …
Hussein Ojaghi
  • 2,260
  • 3
  • 23
  • 41
104
votes
6 answers

Rxandroid What's the difference between SubscribeOn and ObserveOn

I am just learning Rx-java and Rxandroid2 and I am just confused what is the major difference between in SubscribeOn and ObserveOn.
Rathore
  • 1,926
  • 3
  • 19
  • 29
102
votes
8 answers

Combine a list of Observables and wait until all completed

TL;DR How to convert Task.whenAll(List) into RxJava? My existing code uses Bolts to build up a list of asynchronous tasks and waits until all of those tasks finish before performing other steps. Essentially, it builds up a List and…
Craig Russell
  • 3,534
  • 3
  • 26
  • 27
85
votes
1 answer

Retrofit with Rxjava Schedulers.newThread() vs Schedulers.io()

What are the benefits to use Schedulers.newThread() vs Schedulers.io() in Retrofit network request. I have seen many examples that use io(), but I want to understand why. Example…
Mikelis Kaneps
  • 4,576
  • 2
  • 34
  • 48
80
votes
3 answers

How to use CompositeDisposable of RxJava 2?

In RxJava 1, there was CompositeSubscription, but that is not present in RxJava2, There is something CompositeDisposable in rxJava2. How do I use CompositeDisposable or Disposable in RxJava2?
anand gaurav
  • 915
  • 2
  • 7
  • 9
59
votes
11 answers

How to ignore error and continue infinite stream?

I would like to know how to ignore exceptions and continue infinite stream (in my case stream of locations)? I'm fetching current user position (using Android-ReactiveLocation) and then sending them to my API (using Retrofit). In my case, when…
Ziem
  • 6,579
  • 8
  • 53
  • 86
48
votes
2 answers

rxjava merge observables of different type

I'm new to rxjava. I need to combine two observables that emit objects of different type. Something like Observable and Observable and get a Observable. I couldn't find any operator for something like this. What would…
Jelly
  • 4,522
  • 6
  • 26
  • 42
47
votes
15 answers

Deliver the first item immediately, 'debounce' following items

Consider the following use case: need to deliver first item as soon as possible need to debounce following events with 1 second timeout I ended up implementing custom operator based on OperatorDebounceWithTime then using it like this .lift(new…
tomrozb
  • 25,773
  • 31
  • 101
  • 122
44
votes
5 answers

Retrofit API call receives "HTTP FAILED: java.io.IOException: Canceled"

Can't figure out why is this happening. Neither one of rx callbacks (onCompleted(), onError(), onNext()) not gets triggered by my call. The only thing i receive is this okhttp output: D/OkHttp: --> GET…
oleg.v
  • 1,065
  • 3
  • 11
  • 20
43
votes
7 answers

How to stop and resume Observable.interval emiting ticks

This will emit a tick every 5 seconds. Observable.interval(5, TimeUnit.SECONDS, Schedulers.io()) .subscribe(tick -> Log.d(TAG, "tick = "+tick)); To stop it you can use Schedulers.shutdown(); But then all the Schedulers stops and it is…
Jan Seevers
  • 768
  • 1
  • 11
  • 20
41
votes
4 answers

RxJava: Error occurred when trying to propagate error to Observer.onError

I am getting a IllegalStateException error in the Rx Library and don't know exactly where the root of the issue is, whether it is with RxJava or something I may be doing incorrectly. The fatal crash occurs when certificate pinning (occurs on all…
Scott B
  • 1,478
  • 2
  • 16
  • 26
40
votes
3 answers

How do I get Response body when there is an error when using Retrofit 2.0 Observables

I am using Retrofit 2.0 to make api calls that return Observables. It all works good when the call went through fine and the response is as expected. Now let's say we have an error response, it throws an onError. I would like to read the response…
achie
  • 4,716
  • 7
  • 45
  • 59
1
2 3
99 100