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
0
votes
2 answers

Rx (RxKotlin) - rightGroupJoin using groupJoin - merge / combine two observables of different types

After struggling for a few days now, on what seems to be a simple task, I come to you guys:) Idea is simple. I have two streams/observables, 'left' and 'right'. I want items from 'right' to buffer/collect/aggregate to 'current' item in 'left'. Thus,…
guy_m
  • 3,110
  • 2
  • 19
  • 33
0
votes
1 answer

Rxjava - Iterate the list with batch

i have a list of some strings, where i need to iterate the list in batch. Example : val list = ["a","b","c","d","e","f"] Observable.fromIteratable(list) .map{ //here i need to get 4 items at a time //like in first…
Stack
  • 1,164
  • 1
  • 13
  • 26
0
votes
1 answer

RxKotlin - Process gets terminated when dispose is called

i am trying the upload the image through rxkotlin, my problem is when i close my screen in my application, the uploading process gets terminated because am adding that subscription to my disposal, so when my screen closes or destroys i will be…
Stack
  • 1,164
  • 1
  • 13
  • 26
0
votes
2 answers

Kotlin pass function as a parameter vs lambda implementation

I'm using the io.reactivex.rxkotlin extension function: fun Observable.subscribeBy( onError: (Throwable) -> Unit = onErrorStub, onComplete: () -> Unit = onCompleteStub, onNext: (T) -> Unit = onNextStub …
CookieMonster
  • 1,723
  • 1
  • 15
  • 15
0
votes
1 answer

Single concatArrayEager doesnt subscribe to all sources

I am writing some repository logic for android application, I have this logic for retrieving data from database and updating the database with data from api immediately after that. fun fetchData(): Single { return…
estn
  • 1,203
  • 1
  • 12
  • 25
0
votes
3 answers

How to break RxJava chain on error Result?

I've inherited this codebase which uses RxJava2 and kotlin with a rather peculiar Result pattern for API calls. i.e. all API calls return Singles with a Result object (which is a sealed class of Success and Error types as shown below) i.e. sealed…
Bootstrapper
  • 1,089
  • 3
  • 14
  • 33
0
votes
1 answer

Simplify the statement using rxkotlin

I've wanted to try RxJava with kotlin to make coding easier, so I've produced this: fun postAnswers() { disposable = getToken.execute().subscribe({ token -> questions.forEach { form -> val answers = form.answers?.filter {…
Lukas Anda
  • 716
  • 1
  • 9
  • 30
0
votes
1 answer

Custom RxJava Observable emits nothing on subscribe

I'v got this method from here and it works well: @Throws(IOException::class) fun readTextFromUri(ctx: Context, uri: Uri): String { val stringBuilder = StringBuilder() ctx.contentResolver.openInputStream(uri)?.use { inputStream -> …
RuNo280
  • 573
  • 4
  • 27
0
votes
2 answers

How can I achieve this requirement using Rx Java

I have a State(Enum) that contains (Good, Non-Critical, Critical) values So requirement is : should trigger when state goes in non-critical state. should trigger when state goes in critical state. should trigger when state stays in critical state…
Bhuvnesh
  • 1,055
  • 9
  • 29
0
votes
1 answer

mapping custom data RxAndroid with Kotlin

I am trying to convert examples from this article from Java to Kotlin. I get error from picture at Exmaple 5: And I noticed, that without map() function I don't get this error So, what the point of this error and how to write it right?
FIL201121
  • 114
  • 1
  • 10
0
votes
1 answer

Create a filtered observable from 2 observable of list of items in RxJava

I am working on a feature where I need to filter out the network response data based on local database data. For example, my network layers return me a list of items and my database layer returns an observable list of ids. Now I want to only return…
0
votes
1 answer

In RxJava/RxKotlin, what are the differences between returning a Completable.error(Exception()) and throwing?

What are the differences in the following cases: fun a(params: String) = Completable.fromAction { if (params.isEmpty()) { throw EmptyRequiredFieldException() } } VS fun b(params: String) = if(params.isEmpty()) …
0
votes
1 answer

doOnDispose does not get called when subscribing on a background scheduler

I am trying to bridge some existing rx code and api that uses futures. When I manually dispose an observable I would expect onDispose() to be always called. It usually does but when I specify a custom scheduler it sometimes does not get called. My…
Pawel
  • 191
  • 1
  • 6
0
votes
0 answers

Cannot resolve corresponding JNI Function | Open CV | Android | Kotlin

I've successfully compiled and able to run the app into the device, since I am getting this issue trying to use any JNIs function. Here is the error which I am stuck at -
0
votes
1 answer

RxJava: concatMap() with zip() gets stuck

I have a dummy network data source: fun networkDataSource(): Single> { return Single.just((0 until 100).toList()) .delay(150, TimeUnit.MILLISECONDS) } Here is an endless observable. It's main use is that…
andras
  • 3,305
  • 5
  • 30
  • 45