Answer the question
In order to leave comments, you need to log in
How to retry a method call on error using RxJava?
I'm learning RxJava. It is not possible to repeat the method call, which will contact the network and pull out a Json response.
The wideoInfoWrapper() method may fail, if this happens I need to perform certain actions and repeat the call to this method (n times). Can you tell me what methods and where to use?
fun getPlayingVideo(videoId: String){
_networkState.set(NetworkState.LOADING)
try{
compositeDisposable.add(
videoInfoWrapper(videoId)
.subscribeOn(Schedulers.io())
.subscribe ({
playingVideo.postValue(it)
_networkState.set(NetworkState.LOADED)
_networkState.set(NetworkState.WAITING)
},{
errorHandle(it)
})
)
}
catch (e: Exception){
Log.e("fetchVideos",e.message)
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question