Photo by Patrick Tomasso on Unsplash

Why did I write this article?

When Google announced Paging library in Jetpack suite, I was so grateful. My task was to implement a Network-Database (Room) structure data list that I could finish it within a couple of days by using the library.

In the last article, we talked about a state machine and how it could help our Android Development. We will keep diving deeper into how it could help us more by adding logic into the Auto Retry Mechanism, implement side effects, and integrating it into an Android application.

The state machine in Android series:

Part1: Why and How?

Part2: Android integration, and more? (this.article)

Implement side effects

In the previous article, we only defined the side effects and triggered them along with specific events. We need to implement the behavior of those side effects.

First, we need to listen to the side effects…

Photo by Carlos Irineu da Costa on Unsplash

State Management is a very regular thing we, as Android developers, have to do every day. From displaying a loading dialog when your user hits a button to managing network error with complex conditioning layers. The party is usually under control when we only have a couple of states to manage, such as:

  • Is loading dialog being displayed?
  • Is loading dialog dismissed, and the user’s data is ready to be shown?

Is the code above similar to you?

That looks very easy to manage. But when we invite more guests to the party, drunk guys could cause some problems.

Photo by Lex Sirikiat on Unsplash

This article is the second part of my series about Solve Network-Database (Room) by Android Jetpack Paging library and Coroutine:

In the first article, We went through how to solve network-database(room) by using Paging library and Coroutine. This article is about adding a refresh feature to the flow.

Why do we need to have a refresh feature?

With the first article, your app is able to…

An Nguyen

Dad, Husband, Android Developer, Manga/Video Game Lover, Unity3d learner.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store