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

RxJava - How to return the last 2 items from a Flowable for a new Observer

I have a Flowable that returns the LATEST set of String. This is part of a library class. Is there a way for me to return the last 2 strings when a new observer subscribes to this Flowable. I can make changes to the Flowable to be setup with…
1
vote
0 answers

ExoPlayer - Player is accessed on the wrong thread with RxJava2

From past developers, I got a large library, which is built on the basis of ExoPlayer, which allows you to listen to audio books. Everything worked fine until the library itself had to update the version of ExoPlayer to a newer one (this was very…
onesector
  • 361
  • 5
  • 18
1
vote
0 answers

How to create a stopwatch with Rx counting down to 0?

How can I create a stopwatch with Rx in Kotlinv with Observables, so anything can subscribe to it: It shall remain even when I put the app in background I start the Observable with anything I configure: 9000 [ms], 600 [s], etc. It counts down to 0…
Ralf Wickum
  • 2,850
  • 9
  • 55
  • 103
1
vote
1 answer

Listener for objects that are dropped by throttle

Currently, I am trying to use throttle with my observable: observable .throttleLatest(1000, TimeUnit.MILLISECONDS) .subscribe { myObject -> myObject.doA() } The problem here is that I want to destroy all…
Kingfisher Phuoc
  • 8,052
  • 9
  • 46
  • 86
1
vote
1 answer

What is the difference between rxkotlin and LiveData?

I am learning Rx and I do not understand the difference between the two. Can you explain briefly?
1
vote
0 answers

Android kotlin Rx optimise frequently invoked method

Method refresh() is called very often. How to make this code better? How to use RX to avoid unnecessary computation? Last result will always be needed to be published. So far I only added a code to avoid do a computation at the same time. Also I…
kkkkk
  • 572
  • 1
  • 10
  • 21
1
vote
0 answers

Kotlin - RxJava Subscribe doesn't trigger whene there is an event

I Initialize Publish Subject Rx Java in my activity like this private var publisher = PublishSubject.create() And I try to create simple publish onNext like this in a button : binding.btnFab.setOnClickListener { …
1
vote
1 answer

Kotlin RX .zipWith function body executes once or once per observer?

When data is transmitted to my app, it follows a sequence of: 1 ReadStart packet with ID information 1 or more DataPackets that are combined to form the payload 1 ReadDone packet to signal the transfer is done I have a Kotlin RX function that…
simpleuser
  • 1,617
  • 25
  • 36
1
vote
1 answer

RxKotlin COUNT with GROUP BY and return a list

I have a list of recurring elements in Kotlin, say: val result = arrayListOf("AA", "BB", "CC", "AA", "BB") I would like to group them by their value along with how many times they appear, so the output would be pairs of: {"AA", 2}, {"BB",…
user1154390
  • 2,331
  • 3
  • 25
  • 32
1
vote
1 answer

Rx how to return Throwable or Object based on error type

I have a method that returns an Observable. I have this case where, in case of error I need to check error type, and for some specific error I need to return MyObject instead of error. Example: override fun getSomething(param: String):…
ghita
  • 2,746
  • 7
  • 30
  • 54
1
vote
1 answer

Can't migrate accurately from RxJava2 to RxJava3

I can't convert this method to RxJava3 despite having upgraded the dependencies fun setSearchField(searchField: EditText) { searchDisposable = searchField.afterTextChangeEvents() .skipInitialValue() .debounce(400,…
Kred
  • 319
  • 3
  • 12
1
vote
1 answer

How to have single login in my all other apps like Amazon do

If I have 2 apps and the user had logged in one of them. How can I make the user automatically login in the other app? So, one login in either app is sufficient for accessing both of them. For e.g. like if I have Amazon app I don't have to login in…
RAHUL MAURYA
  • 306
  • 1
  • 9
1
vote
1 answer

Repository pattern concatenating results in RXKotlin

Trying to come with a offline-first app, I managed to make a working repository pattern which first check the cache, then the database and finally, the api. I do that like this: private fun cachedTopics(): Maybe> { ... } private fun…
Clément Jean
  • 1,735
  • 1
  • 14
  • 32
1
vote
1 answer

How to do the filter operator from a list of a list in rxjava

Good afternoon. So I got a list with a list inside like this: { "category" : [ { "name": "Bathroom", "products": [ { "name": "Sink01" }, { "name": "Shower01" } ] …
linker85
  • 1,601
  • 5
  • 26
  • 44
1
vote
0 answers

Android: want to fetch data from roomDB when 2 variables changed

I wanna fetch data from roomDB when variable changed. When folderName changed and when task changed. I use MediatorLiveData, but it doesn't work. How can I fix it? This is a view model class. val folderName = ViewModelFolder.selectedFolder //…
Pytan
  • 1,138
  • 11
  • 28