Fragmented - An Android Developer Podcast

The Fragmented Podcast is a podcast for Android Developers hosted by Donn Felker and Kaushik Gopal. Our goal is to help you become a better Android Developer. We chat about topics such as Testing, Dependency Injection, Patterns and Practices, useful libraries, and much more. We will also be interviewing some of the top developers out there. Subscribe now and join us on the journey of becoming a better Android Developer.

http://www.fragmentedpodcast.com

subscribe
share






episode 147: 147: Disposing RxJava 2 Streams with AutoDispose


In this short fragment episode, Donn explains how you can clean up your RxJava 2 streams and ensure no memory leaks are occurring by using the AutoDispose library from Uber.

Shownotes
  • AutoDispose Library
  • Tool to help migrate to RxJava 2
    CatchUp Library
Code Samples

Java

myObservable .map(...) .as(AutoDispose.autoDisposable(AndroidLifecycleScopeProvider.from(this))) .subscribe(...)

Kotlin

myObservable .map(...) .autoDisposable(AndroidLifcycleScopeProvider.from(this)) .subscribe(...)

With Scope Event Provided

myObservable .map(...) .autoDisposable(AndroidLifcycleScopeProvider.from(this, Lifecycle.Event.ON_DESTROY)) .subscribe(...)

Testing

// File: CustomerService.kt class CustomerService @Inject constructor(...) { lateinit var scopeProvider: ScopeProvider } // Usage in Fragment/Activity/etc val service = CustomerService(...).apply { scopeProvider = AndroidLifecycleScopeProvider.from(this) } // Usage in Test val service = CustomerService(...).apply { scopeProvider = TestScopeProvider.create() } Contact
  • @fragmentedcast or our Youtube channel
  • @donnfelker and donnfelker (on Instagram)
  • @kaushikgopal and kaushikgopal (on Instagram)
  • Fragmented Chat


fyyd: Podcast Search Engine
share








 December 31, 2018  15m