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.

Download

Shownotes

Code Samples

Java

myObservable
    .map(...)
    .as(AutoDispose.<SomeType>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

146: 3 Things Every Android Developer Needs to Know

In this episode of Fragmented, Donn digs into three things that every Android developer needs to know.

Download

  • Dependency Injection

    1. Constructor_setter_method injection
    2. Service Locators or other DI frameworks
    3. Common Frameworks
      1. Dagger
      2. Koin
      3. Kodein
      4. ToothPick
  • How to test

    1. Functional / System
    2. Integration
    3. Unit
    4. Tools:
      1. jUnit
      2. Espresso
      3. Spek
  • Keep it simple simple

    1. KISS principle KISS principle – Wikipedia
    2. Examples
      1. Code Duplication
        1. “Extract this into a method”
      2. Lets create a framework for this
      3. Kaushik’s – 3x rule
        • if something is duplicated 3 or more times, think about extracting it
      4. 3/6 Rule – In 6 months, will I be able to understand this in under 3 minutes?

Contact

145: Tracking Network Requests With x-Request-ID

In this short fragment, Kaushik explains how you can trace network requests from your app by adding a special header. Easily trace an HTTP request all the way from a client to your backend web process.

Download

Shownotes

Sponsors 🙏

Contact

143: Real world testing thoughts

In this mini fragment, Donn and Kaushik share some thoughts on real world testing with Android development – a favorite topic of theirs.

Kaushik recently ran into a case where an espresso test fails because the UI stops performing. It’s an interesting discussion on figuring out what matters when you write your tests. They dive into strategies and techniques around testing. What makes a good test, what should you be testing?

They then talk about why Hermetic testing is pretty hard on mobile and ideas around a simple solution that could be provided out of the box. They then round it up talking about TDD and it’s role in today’s world.

Hope you enjoy this one!

Download

Shownotes

Sponsors 🙏

Contact

141: Impostor Syndrome

In this mini fragment, Donn and KG talk about Impostor syndrome. Most of us developers are plagued by this. Does this feeling ever go away? How do we deal with this? Listen to this short episode to find out more.

Download

Shownotes

Sponsors

Contact