Skip to content

Instantly share code, notes, and snippets.

@EudyContreras
Last active April 14, 2020 21:54
Show Gist options
  • Save EudyContreras/2cd8e9875fbdc4e4c849483db5932bc1 to your computer and use it in GitHub Desktop.
Save EudyContreras/2cd8e9875fbdc4e4c849483db5932bc1 to your computer and use it in GitHub Desktop.
private val demoData: MutableLiveData<Resource<List<DemoData?>?>> = MutableLiveData(Resource.Loading())
// Start request and emit a loading state
demoData.postValue(Resource.Loading()
// Request was successfull. Emit the data
demoData.postValue(Resource.Success(data))
// Request failed. Emit the error, etc...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment