Questions tagged [rx-kotlin]

RxJava bindings for Kotlin programming language

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

238 questions
1
vote
1 answer

SwitchIfEmpty not executing maybesource inside

I have some methods Maybe getLocalFoo() Single> getFooFromInternet() And want to check local item and if it's empty then fetch that item from network for example. storage .getLocalFoo() .switchIfEmpty {…
Sunstrike
  • 456
  • 1
  • 6
  • 22
1
vote
4 answers

RxJava: Execute second observables only if first one throws an error and repeat from the first

I am using retorift to hit getAricle api and get list of articles related to the user. getArticle api will throw error if token passed is expired if so then I have to call refreshToken api to get new token then again I have to call the getArticle…
Praveena
  • 6,340
  • 2
  • 40
  • 53
1
vote
1 answer

onNext() never gets called on a PublishSubject

I am trying to build a presenter that calculates some events within some time period, shows a loading only the first time of loading, and updates the ui when it is done. Because the events can be updated via multiple ways (such as user preferences)…
Alex Styl
  • 3,982
  • 2
  • 28
  • 47
1
vote
2 answers

Multiple retrofit2 requests using Flowable in Kotlin

In order to improve my skills in kotlin, Rx, Retrofit2 I've decided to do a demo project. The demo project consist to display posts in a recycler view then display details of the post in a detail activity. I've encountered difficulties displaying…
Hawa Zen
  • 23
  • 5
1
vote
1 answer

How to dynamically scale debounce of burst emission stream?

I've got a buffered stream, waiting for a predetermined amount of silence time, before publishing a list of elements that have been buffered: INTEGERS .share() .buffer(INTEGERS.debounce(DEBOUNCE_TIME,TimeUnit.MILLISECONDS,scheduler)) …
Carter Hudson
  • 1,176
  • 1
  • 11
  • 23
1
vote
1 answer

RxAndroid, How to detect if observable has finished emission

I am writing following code snippet to fetch list of saved food from firebase database and then using that list, I am again fetching individual food details from firebase database. Following code working fine, except i am unable to figure out how to…
Sachin Chandil
  • 17,133
  • 8
  • 47
  • 65
1
vote
2 answers

RxJava1: How to convert Observable>> to Observable>

Can someone help me find the proper solution for this problem I face? I have a backend service that give me Observables of the data I need, which are Events. Form the Event I can get an EventGroup, which contains Ids of all events in the same…
Endran
  • 1,627
  • 1
  • 10
  • 15
1
vote
2 answers

Implementation of a "valve" for Observable streams, including buffering the last element emmitted before the valve reopened

I'm trying to wrap my head around how to implement something in RxJava (2.0). It's for Android and I'm using Kotlin, although the choice of platform and language shouldn't matter here. The idea is that I'd base some sort of MVP architecture on…
Konrad Morawski
  • 8,307
  • 7
  • 53
  • 91
1
vote
1 answer

Repeating actions on state with RxJava

This is in Kotlin, but I think anyone who writes Java will be able to understand. I'm trying to make a stopwatch with Rx and I'm having a little trouble with doing the actual stopping and starting. The big problem is that I don't know how to keep…
mrobinson7627
  • 298
  • 1
  • 4
  • 13
1
vote
1 answer

RxKotlin flattenAsObservable(): type mismatch with method reference

I'm converting some Java code to Kotlin and I'm having some trouble with flattenAsObservable() Here's what the code looked like in Java: discogsInteractor.search(query) .map(RootSearchResponse::getSearchResults) …
Josh Laird
  • 6,974
  • 7
  • 38
  • 69
1
vote
1 answer

For a Kotlin function used as an expression, is there concise way to operate on and return a value?

In Kotlin the final statement of a function can be interpreted as its return value. Can a situation like the following example be simplified to be less verbose? { text: String -> val validated = validateText(text) if (validated) { …
Conor K.
  • 25
  • 1
  • 8
1
vote
1 answer

RxKotlin - Single.just() does not emit when subscribing TestSubscriber

I thought this is how it works, seems like I'm missing something.. @Test fun singleCompletes() { val testSubscriber = TestSubscriber() Single.just(true) .subscribeOn(Schedulers.immediate()) .subscribe {…
Zackline
  • 804
  • 1
  • 9
  • 28
1
vote
0 answers

OnComplete never called with toSortedList() and groupBy()

I'm currently using the Android-ReactiveLocation Library (Github). The LastKnownLocationObservable (Code) is working as intended. I'm using a flatMap to fetch nearby stations from a db and (because of realm) I'm creating a model from the data. So I…
vork
  • 71
  • 1
  • 6
1
vote
2 answers

Kotlin library 'rxkotlin-0.21.0.jar' has an unsupported format. Please update the library or the plugin

The error in the title appears in Android Studio as a warning bar above all my code: Android Studio version: 1.1.0 Kotlin plugin version for Android Studio: 0.11.91.AndroidStudio.4 build.gradle file that seems to be using all the most recent…
Amandeep Grewal
  • 1,801
  • 3
  • 19
  • 30
0
votes
0 answers

Does anyone tried long polling in android with rxKotlin? Please help me

When I request api, the Server will send a response after 10 seconds. And after the client got the response, I had to request back the API immediately. Like this. fun getSampleApi() { sampleApiService.requestApi( …