I'm new for learning android architecture components and I have stuck in the question several days.
I use LiveDataReactiveStreams to transform Livedata and Flowable, all of them works well, except handling RxJava's onError.
livedata = LiveDataReactiveStreams.fromPublisher(
// bookRepository.getAll() return a Flowable
bookRepository.getAll().map {
val allBookNames = mutableListOf<String>()
it.forEach {
allBookNames.add(it.name)
}
return@map allBookNames.toList()
}
)
I saw How to handle error states with LiveData? and figure out I can
wrap my data to Handle my error
or use MediatorLiveData as @Nikola Despotoski said, but there is an another question is Flowable onComplete() is never called.
Is there a better way to solve this question or any details about these two solutions I've ignored?