Error Handling and Retry
This lesson will teach you how to handle and recover from errors.
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 the loading of the blog article failed, 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 1400+ tech skills courses.