Monitor network connectivity, and show a SnackBar when the connection is lost.
Read more…All snippets tagged with livedata
Page 1 of 1Connectivity live data
Pagination
A very complete recipe that implements a RecyclerView that pulls in paginated data, using Retrofit, LiveData. It includes example models, adapter, viewholders, and a viewholder for displaying the network state in case of an error.
Read more…Double trigger livedata transformation
A replacement for the mediator LiveData for triggering LiveData transformations.
Read more…Absent live data
A LiveData class that has null
value.
Okhttp 401 handler
Handle session expirations and 401 error codes. The following code will be activated if the API responds with a 401 (no authentication). If there’s a token that should be renewed, we first renew the token and if this is successful we try the original request again.
Read more…Pagination
A very complete recipe that implements a RecyclerView that pulls in paginated data, using Retrofit, LiveData. It includes example models, adapter, viewholders, and a viewholder for displaying the network state in case of an error.
Read more…Centralized error handling
Global error handling for REST requests.
Read more…