These are chat archives for ReactiveX/RxJava
RxJava – Reactive Extensions for the JVM – a library for composing asynchronous and event-based programs using observable sequences for the Java VM.
Hi, I'm building an app, in which I have a list of images, each is loaded asynchronously.
Each time an item in the list is required to display its content it makes a request like so (pseudo-code):
dataAccess.loadImage(url).subscribe(data => cell.imgData = data)
Now, a button which causes the list to refresh and load all its cells can be pressed numerous times by the user.
What happens now is that previous requests of the
loadImage method are showing even if they do not belong to the current request.
I could assign a request id and verify upon the load request finish that the ids still match, but I'd really like to cancel the request if it's no longer needed, and also to find a more ReactiveX way of doing so.
My thinking is that I should be able somehow to build an observable stream that would include both the user initiated requests and the responses and to somehow zip them together, but I'm not sure how to approach that, since I'm opening a different sequence for each cell...