O'Reilly logo

Reactive Android Programming by Tadas Subonis

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Showing errors in Android UI

Let's experiment a bit with error reporting on Android UI. It's important to properly handle errors not only in the sense that they should be logged and shouldn't kill the app, but the user should always be informed as to what happened. There are several patterns of what can be done on different kinds of failures.

Here, we will explore two options: Empty State Screen, when stock updates can't be loaded or if there are none, and a Toast notification, when the initial fetch of the data failed but we will try backing to the data that's saved in the SQLite database.

When developing for Android, it is often useful to check Material UI guidelines. They have some really great tips on how to handle errors at https://material.io/guidelines/patterns/errors.html ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required