Describe the problem
private fun getMarsPhotos() {
viewModelScope.launch {
marsUiState = try {
val listResult = MarsApi.retrofitService.getPhotos()
MarsUiState.Success(listResult)
} catch (e: IOException) {
MarsUiState.Error
}
}
}
This code foregets to add marsUiState = MarsUiState.Loading. i found the solution in github repository. but it definitely causes confusion as the screenshots in the codelab shows loading screen as well.
Steps to reproduce?
Go to...
Click on...
See error...
VersionsAndroid Studio version:API version of the emulator:
Additional informationInclude screenshots if they would be useful in clarifying the problem.
URL of codelab:
https://developer.android.com/codelabs/basic-android-kotlin-compose-getting-data-internet?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-5-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-getting-data-internet#6
In which task and step of the codelab can this issue be found? Step 7. Add Internet permission and Exception Handling
Describe the problem private fun getMarsPhotos() { viewModelScope.launch { marsUiState = try { val listResult = MarsApi.retrofitService.getPhotos() MarsUiState.Success(listResult) } catch (e: IOException) { MarsUiState.Error } } }
This code foregets to add marsUiState = MarsUiState.Loading. i found the solution in github repository. but it definitely causes confusion as the screenshots in the codelab shows loading screen as well.
Steps to reproduce?
Versions Android Studio version: API version of the emulator:
Additional information Include screenshots if they would be useful in clarifying the problem.