Finding a Job (10 Part Series)
Yo, it's day 4 of my journey.
Worked on setting up local persistence to make my app accessible offline (maybe with stale data but still).
I used Room for storing data offline, and I must say it's been a joy to use it.
When I first started developing Android apps, I remember I had to deal with nasty cursor implementations to store/fetch data from SQLite.
Then, Realm came and made storing local data a way lot easier.
Room is on another level. You get the same benefits of using an ORM over SQLite with added benefits like:
Compile-time query validations
First-class support for
LiveDataand Kotlin coroutines
I spent the whole morning learning Kotlin coroutines and how they're useful for an Android app.
I remember the time when I first got into reactive programming. RxJava on Android seemed like magic.
Kotlin coroutines are a notch above that. It's an absolute joy to work with coroutines, primarily since popular libraries like Retrofit and Room support it out of the box.
Also, running coroutines with a
viewModelScope means you don't have to worry about cancelling your coroutines when your user navigates away from a screen. Any child coroutines that they launch gets cancelled with the parent coroutines.
You can learn more about this here: https://medium.com/androiddevelopers/coroutines-on-android-part-i-getting-the-background-3e0e54d20bb
I need to create a binding adapter to allow Glide to load images to my
ImageView using data binding.
After that, my main focus will be to learn how to do automated testing on Android.
My plan is to:
- Start with unit testing view models
- Progress to instrumentation tests for repositories
- Finish up with UI tests for controllers (Activity, Fragments, etc)
Let's see how much I can get done today.