I have a LiveData for fetching data from server and this LiveData may receive some time error response, so i need to fetch data again. can i notify that data resource that refresh server request again?
val movies : LiveData<Result<Movies>>? by lazy {
model.getMovies()
}
You can use MutableLiveData to achieve this. For example you can do something like this:
val movies: MutableLiveData<Result<Movies>>? by lazy {
model.getMovies()
}
fun retryGetMovies() {
val response = model.getMovies()
movies.postValue(response)
}