Learning RxJava (for Android) by example
Video Statistics and Information
Channel: InfoQ
Views: 151,109
Rating: 4.8703403 out of 5
Keywords: Android (Operating System), SF Android, Kaushik Gopal, RxJava, RxAndroid, Java, fragmented podcast, introduction, wedding party, free resources, live code
Id: k3D0cWyNno4
Channel Id: undefined
Length: 74min 30sec (4470 seconds)
Published: Mon Jun 29 2015
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.
Good, informative talk.
Can't seem to figure out how to use RxJava to download a file with known URL, however. He mentions using Retrofit at one point. Maybe I need to look into that.
excellent.
This looks promising.
The guy at 44:00 asked a very good question. If we run a long running task and the user flips the screen frequently we can get an out of memory event easily. This is why we have so many "hate AsyncTask" speech out there. The answer is to not use anonymous classes when defining observables. This is not an easy solution - our observables mostly consist of anonymous classes. Another option is to use MVP to not hold a reference to the view during observable execution.
Amazing.... I think I can finally move my asynctasks to RxJava without actually reading too much....
I wish they would post the example code.
At 39:40ish, there's a question about Loaders vs. RxJava Observables. Technically, they are not interchangeable. Loaders can deliver async data to Activities and Fragments even after they've been destroyed and recreated because of a configuration change. Observables can't do this out of the box.
This is discussed in the Developing Android Apps udacity course: https://www.youtube.com/watch?v=qrPoIF6A9gM
OK so I watched the talk and thought, "Great, I can try this out now." Unfortunately, what I perceive as the simplest of examples is failing. Can someone (/u/kaushikgopal ?) ELI5 why this isn't working to get me in the proper mindset?
By "not working", I mean it doesn't print anything out. If I remove the
.subscribeOn(...)
, it works fine. Note: this was in pure Java, if that makes a difference. I hadn't even gotten to Android yet. I also tried adding a.observeOn(Schedulers.immediate())
thinking that would be analogous to observing on Android's main thread, but it didn't seem to matter if I included it or not. Thanks.