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

E/Error: retrofit2.adapter.rxjava2.HttpException: HTTP 401 Unauthorized in kotlin android

This is the response i am trying to fetch from the api { "success": { "id": 35, "otp": 9830, "msg": "Otp has sent on this number" } } The response is working absolutely fine when checked in postman . However when i…
Buraq24 Rep
  • 23
  • 1
  • 9
1
vote
2 answers

RxJava - Count events on the fly

I would like to count objects passing from observable. I know there is a count operator but that can't be used for infinite streams because it waits for completition. What I want is something like Value -> operator -> Pair(Int, Value). I know there…
bio007
  • 893
  • 11
  • 20
1
vote
3 answers

rx - Conditional flatMap / add condition to flowable boolean

I need to show error view if status is error and call.isEmpty() returns true. Is there a better way to achieve this result? val errorVisible = states.asFlowable() .map { it.status == Status.ERROR } .flatMap { isError -> if (isError)…
alashow
  • 2,735
  • 3
  • 21
  • 47
1
vote
2 answers

Chain a request in retrofit using rxJava2 and populate the result in recyclerview

I am trying to consume an API from thesportsdb to display lastmatch from specific league. in my recyclerview I want to show the team badge for every teams but when I request the lastmatch API it didn't include the team badge, only the id for each…
mangkool
  • 316
  • 2
  • 18
1
vote
2 answers

Not able to download multiple video files from json and set the download path to the same list

I am using RxAndroid ,Retrofit and SqlBrite . POJO Classes: Eg : file_path = "....../videos/.mp4" public class VideoResponse { @SerializedName("files") @Expose private List files = null; ..... } public class…
robin_24
  • 109
  • 2
  • 9
1
vote
1 answer

subscribing to an observable in the chain and setting the observer to the observable

kotlin 1.2.60 rxJava 2 I have the following code snippet below. I am wondering what is the difference in using the subscribe that is chained to the end of flatmap and printing the results or creating an observer and subscribing to the Observable.…
ant2009
  • 27,094
  • 154
  • 411
  • 609
1
vote
1 answer

How to convert normal data(returned from room) to LiveData on ViewModel layer

I am using the clean architecture with MVVM pattern so the room part goes into the data layer and I'm returning observables from there to domain layer and using them in presentation layer by wrapping them in a LiveData. Now, the problem is that…
1
vote
3 answers

Combine database and network call with RxJava2

I have 2 data sources: database (cache) and api and I need to combine them into one stream. I know that I can simply use concatArray or something similar but I want to achieve more complicated behavior: Observable stream which will emit up to 2…
Jared Bts.
  • 89
  • 7
1
vote
1 answer

Returning Observable on Network calls with retrofit

I'm making a simple recyclerview list with items returned from an API. I have my retrofit client open class CoinListRetroFit { val httpLoggingInterceptor = HttpLoggingInterceptor() val okHttpClient = OkHttpClient.Builder() …
Kyle
  • 695
  • 6
  • 24
1
vote
2 answers

How to process all events emitted by RX Java regardless of error?

I'm using vertx.io web framework to send a list of items to a downstream HTTP server. records.records() emits 4 records and I have specifically set the web client to connect to the wrong I.P/port. Processing... prints 4 times. Exception outer!…
user432024
  • 4,392
  • 8
  • 49
  • 85
1
vote
1 answer

Starting again a Retrofit call subscribing the Observable again from onError Callback in RXJava

When the Retrofit Call does not succeed ( for example because no Internet), is called as expected the RXJava Callback onError, where I have a Snackbar with a setAction() Listener indicated with an intuitive String "Retry" where I should pass a…
Drocchio
  • 383
  • 4
  • 21
1
vote
1 answer

RxJava - Combine sequence of requests in loop

Lets say I have 3 servers (with same API): | S1 | S2 | S3 | | postSomething(data) | postSomething(data) | postSomething(data) | What I need is this (in…
sharonooo
  • 684
  • 3
  • 8
  • 25
1
vote
1 answer

RxJava2 Maybe to Single NoSuchElementException

I'm newbie with RxJava2. I have next code: fun signIn(): Completable = getCredentials() // get saved token .onErrorResumeNext { makeLockSignInRequest() } // if token not saved then get it .flatMap { refreshToken(it) } // refresh…
Max Polkovnik
  • 319
  • 1
  • 5
  • 18
1
vote
1 answer

How to wrap listener by rxjava2 and handle the thread switch?

I wrap listener with below code, public Observable getIdToken() { return Observable.create(emitter -> { firebaseAuth.getAccessToken(false) .addOnSuccessListener(getTokenResult -> { …
candrwow
  • 511
  • 5
  • 21
1
vote
3 answers

Make sure network call is only executed once per button in recyclerview row (RxJava)

I have a fragment that contains a RecyclerView that displays search results of users. Each user row in the RecyclerView contains a Follow/Unfollow button, which upon clicking, causing the hosting fragment to execute the appropriate network call in…
sbearben
  • 323
  • 6
  • 16
1 2 3
99
100