Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class SpeciesListViewModel : ViewModel() {
- @Inject
- lateinit var repository: SpeciesRepository
- var isLoading = MutableLiveData<Boolean>()
- var apiError = MutableLiveData<Throwable>()
- var speciesResponse = MutableLiveData<List<Species>>()
- fun getSpecies() {
- isLoading.value = true
- repository.getSpecies(
- {
- speciesResponse.value = it
- isLoading.value = false
- },
- {
- apiError.value = it
- isLoading.value = false
- })
- }
- //ignore other code
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement