A few weeks ago, the folks working on Kotlin announced the 1.1 release. Kotlin’s 1.1 release has experiment support for coroutines. Here’s the elevator pitch for coroutines from their blog post announcing the release: Asynchronous programming is taking over the world, and the only thing that is holding us back is that non-blocking code adds considerable complexity to our systems. Kotlin now offers means to tame this complexity by making coroutines first-class citizens in the language through the single primitive: suspending functions. »
Loaders are awesome…they’re essentially the best practice implementation of asynchronous data loading in your Activities.
-Reto Meier, Developing Android Apps Udacity Course The following code should make you nervous:»
I concluded my last post by summing up what we’ve seen so far and what we still need to understand about RxJava:
We now know what an asynchronous data stream is and we know that RxJava uses the Observer pattern to deliver these streams to everyone that’s interested. We still don’t know, however, what it means for a data stream to be “functionally transformed” nor do we know how RxJava allows us to represent anything as an asynchronous data stream that can be created and consumed on any thread. These are questions I’ll have to tackle in the second part of this written version of my upcoming RxJava talk.
In this post, I’ll fill in the missing gaps in our understanding of my initial statement of what RxJava allows us to do.»
Earlier today, I gave my Intro To RxJava talk. I’m not thrilled at how clear I was at explaining certain aspects of RxJava, but here’s the video nonetheless. My talk starts at 28:32. Hopefully, I’ll do a better job when I finish the written version of this talk. If you want to hear a hilarious take down of the design of the new Pizza Hut app, check out Ian’s talk that happens before mine. »
Edit: Shortly after writing this, I realized that the solution that I present here isn’t very good. I’m leaving it here just in case it can serve as a building block for better solutions. Sometimes you don’t have control over the lifecycle of your Subscribers. In these cases, to avoid leaking your Subscriber, you have to unsubscribe from your Observable when you’re notified that your Subscriber is about to be destroyed. »