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
2
votes
1 answer

Rxjava, combineLatest with RxTextView memory leak

I'm trying to use combineLatest with several RxTextViews and I thought that I was disposing my Disposables properly but it looks like I'm still getting a memory leak. val one = RxTextView.afterTextChangeEvents(one) val two =…
alisonthemonster
  • 1,095
  • 1
  • 11
  • 28
2
votes
2 answers

Convert my EditText Input to an observable stream

So i have been trying to convert my EditText input that i get from my TextWatcher to an observable of stream but i cannot convert it. I am trying the following etSearch.addTextChangedListener(object: TextWatcher{ override fun…
Rajat Beck
  • 1,523
  • 1
  • 14
  • 29
2
votes
0 answers

rxJava and app lifecycle error

I use rxjava to read from the room database on the Schedulers.io thread. I've noticed that when my app is killed and reopened it always crashes with Cannot access database on the main thread since it may potentially lock the UI for a long period…
Tuesday Four AM
  • 1,186
  • 1
  • 11
  • 18
2
votes
1 answer

PublishSubject does not work with firstOrError()

Can someone please explain me why PublishSubject is not working nicely with firstOrError()? I'm expecting firstOrError to return a NoSuchElementException when the PublishSubject is created without any value. I wrote some tests in order to better…
dvdciri
  • 441
  • 6
  • 19
2
votes
2 answers

Response zip file with WebFlux

I am new in Spring 5 and Reactive Programming. My problem is creating the export feature for the database by a rest API. User hits GET request -> Server reads data and returns data as a zip file. Because zip file is large, so I need to stream these…
2
votes
2 answers

RxJava: Combining hot and cold observable to wait for each other

I have my observables defined like this val initLoading = Observable.fromCallable { println("${System.currentTimeMillis()}") } .subscribeOn(Schedulers.computation()) .delay(WAIT_TIME, TimeUnit.SECONDS) .map {…
2
votes
1 answer

Avoid memory leak when Observable.create() to emit listener objects

I'm writing a wrapper around FirebaseFirestore snapshot listener that emits the changes using RxKotlin Observable. I wrote the following class which makes use of create() method to create the observable and emit the changes asynchronously when a new…
2
votes
2 answers
2
votes
1 answer

Required and found ?
class TaskRepo(taskData: TaskData) { companion object { private val repoByTask: LRUMap = LRUMap(2, 10); fun getInstance(taskData: TaskData): OrderFormRepo { if (notFoundObject(taskData.taskId)) { …
2
votes
2 answers

Kotlin with RxKotlinFX stack gives Cannot access class error

When im using the following dependencies in my pom file: 2.2.0 2.1.0 1.1.51
user3139545
  • 6,882
  • 13
  • 44
  • 87
2
votes
0 answers

RxJava2 Maybe return empty Observable if no element

Is there a better / more idiomatic way to use a Maybe type from JavaRx 2 than flatMap and try/catch? The following example takes a Maybe and tries to book them a random ticket for a flight. If the user doesn't exist, return an empty…
junglie85
  • 1,243
  • 10
  • 30
2
votes
1 answer

Inject constructor and companion object

I'm kind of new to Kotlin and I'm trying to Inject a value (in this example it is just an Int but in the real code it is a Provider class) What am I doing wrong here? and why is x is an unresolved reference? class Test @Inject constructor(private…
Sharon
  • 508
  • 4
  • 11
2
votes
1 answer

RuntimeException handling best practices

RuntimeExceptions are supposed to indicate programming error and I want my application to crash when something inside my observables throws RuntimeException. What is the best way to do this? Right now I'm considering this solution (it's Kotlin, but…
Dmitry Ryadnenko
  • 22,222
  • 4
  • 42
  • 56
2
votes
1 answer

Can I create a Kotlin extension method for adding an rxJava Subscription to a CompositeSubscription?

I've been playing with Kotlin/RxJava and tried to create an extension method for adding a Subscription to a CompositeSubscription, that would work like: search.subscribe { //do stuff }.addToComposite(compositeSubscription) This is my attempt…
grepx
  • 443
  • 5
  • 7
1
vote
1 answer

How to add andthen() operator under condition or inside a loop Rx Kotlin

I'm trying to chain some rx operations under a condition but the andthen() inside the apply does not execute. Is this correct? operation returns a Completable. Android studio gives me the warning "The result of andThen is not used" in both andthen()…