Error Handling and Retry

Learn how to handle and recover from errors in this lesson.

Loading data from the network is not always successful; sometimes there is a weak internet connection which may lead to the timeout error.

It’s always a good idea to handle error scenarios and inform a user about them. If possible, provide ways to recover from the error. In our example, when a blog article fails to load, we can show an error message with the “Retry” button to try to reload the data.

To implement error handling, find the loadData method of the BlogDetailsActivity class.

Get hands-on with 1200+ tech skills courses.