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
37
votes
3 answers

Android RX - Observable.timer only firing once

So I am trying to create an observable which fires on a regular basis, but for some reason which I cannot figure out, it only fires once. Can anyone see what I am doing wrong? Observable observable = Observable.timer(delay, TimeUnit.SECONDS,…
James King
  • 2,425
  • 7
  • 30
  • 45
36
votes
1 answer

Use RxAndroid or RxKotlin when programming in Kotlin for Android?

I am going to start using reactive programming in my Android project. I am using Kotlin as primary language and now I would like to apply Rx. My first choice was RxAndroid but then I noticed that there is RxKotlin. As far as I know both are forked…
Damian Petla
  • 8,963
  • 5
  • 44
  • 47
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
6 answers

RxJava flatMapIterable with a Single

I'm trying to tidy up my code a little, and Single is looking like a good choice for me as I'm doing something that will only ever emit one result. I'm having an issue though as I was using flatMapIterable previously to take my response (a list) and…
spO_oks
  • 398
  • 1
  • 3
  • 9
34
votes
3 answers

Get the latest value of an Observable and emit it immeditely

I'm trying to get the latest value of a given Observable and get it to emit immediately once it's called. Given the code below as an example: return Observable.just(myObservable.last()) .flatMap(myObservable1 -> { return myObservable1; …
E-Kami
  • 2,529
  • 5
  • 30
  • 50
34
votes
1 answer

Retrofit "IllegalStateException: Already executed"

I have a Retrofit network call that id like to run every 5 seconds. My current code: Handler h = new Handler(); int delay = 5000; //milliseconds h.postDelayed(new Runnable() { public void run() { call.enqueue(new Callback()…
Orbit
  • 2,985
  • 9
  • 49
  • 106
33
votes
3 answers

When to unsubscribe a subscription

I have a question regarding how to unsubscribe an observable. I have two codes and I'm not really sure about which one is better. Example 1 -> Unsubscribe the subscriber once the stream has finished: Subscriber subscriber = new…
MarcForn
  • 3,321
  • 7
  • 25
  • 39
31
votes
3 answers

RxJava : How to handle error with zip operator ?

I am using RxJava and RxAndroid with Retrofit2. Observable responseOneObservable = getRetrofitClient().getDataOne() .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()); Observable responseTwoObservable…
Priyank Patel
  • 12,244
  • 8
  • 65
  • 85
30
votes
3 answers

Difference between RxJava and RxAndroid?

Why do we need to use RxAndroid with RxJava? What is the functional difference between them and actual use of RxAndroid and RxJava? I can't find proper answer for this.
Drim
  • 514
  • 5
  • 18
30
votes
2 answers

rxjava add items after observable was created

I just started using rxjava and I got stuck. Maybe I'm not using rxjava in the right way, but I need to add items to an Observable after it was created. So I understand that You can just call Observable.just("Some", "Items") and the subscribers will…
Jelly
  • 4,522
  • 6
  • 26
  • 42
29
votes
2 answers

How to handle rotation with Retrofit and RxJava/RxAndroid in Activity?

I read here that we can use some global cache in order to handle rotation. You can prevent this by using the cache or replay Observable operators, while making sure the Observable somehow survives the Activity life-cycle (for instance, by storing…
DeniSHow
  • 1,394
  • 1
  • 18
  • 30
25
votes
1 answer

Periodic HTTP Requests Using RxJava and Retrofit

Is it possible to use RxJava/RxAndroid and Retrofit to perform periodic http requests to update data every x seconds? Currently I am using an IntentService and Recursive Handler/Runnable that fires every x seconds. I'd like to know if I could…
Jeremy Lyman
  • 3,084
  • 1
  • 27
  • 35
24
votes
2 answers

Rx 2 Android what is better Single or Observable for api calls?

when we use retrofit2 for doing API rest calls with Rx, What is the best approach to use, Single or Observable? public interface ApiService{ Single getDataFromServer(); Observable getDataFromServer(); }
Jose M Lechon
  • 5,766
  • 6
  • 44
  • 60
24
votes
9 answers

How to resolve Duplicate files copied in APK META-INF/rxjava.properties

I am using rxjava and rxvolley on my android aplication. When I try to run it I get this error Execution failed for task ':testapp:transformResourcesWithMergeJavaResForDebug'. > com.android.build.api.transform.TransformException:…
Dani Garcia
  • 464
  • 1
  • 6
  • 18
24
votes
5 answers

RxJava timer that repeats forever, and can be restarted and stopped at anytime

In android i use Timer to execute task that repeats every 5 seconds and starts after 1 second in this way: Timer timer = new Timer(); timer.scheduleAtFixedRate(new TimerTask() { @Override public void run() { //…
MBH
  • 16,271
  • 19
  • 99
  • 149