Closed TuonBondol closed 6 years ago
RxAndroid is a really tiny project which only contains an Android-specific Scheduler. It's a low-traffic project.
Your question is about RxJava in general. I would suggest either posting to StackOverflow with the 'rx-java' tag or posting to the RxJava mailing list for general usage advice and guidance. You'll reach many more people who are available and willing to help and both of those forums are much more suited for support whereas we tend to reserve issues solely for tracking bugs and feature requests.
Okay! Thank you for your advise :)
Hi there, I am pretty new with RxJava and Rx Android, Currently I starting to use Rx with MVVM pattern in my Android Project, I have encountered with some problem! It work fine is response success, but If it is error and go to error subject, If I try again, It will emit on Next 2 time, and If error 3 time, It will emit 3 time, Here is my code
---- In ViewModel mMainModel.requestCreateQrCode(outTradeNo = outTradeNo!!, notifyUrl = notifyUrl, totalFee = totalFee!!, sign = md5) mMainModel.onResponseQrCodeSuccess.subscribe { hideLoading() if (it.is_success == Constant.RESPONSE_SUCCESS_TRUE) { qrCodeResponse = it.response.alipay MainActivity.onReplaceFragment(mContext, ScanQrCodeFragment()) return@subscribe } onAlertError("Error Code ${it.is_success}") } mMainModel.onResponseQrCodeError.subscribe { hideLoading() onAlertError("onResponseQrCodeError $it") }
---- in Model Request private val mResponseCreateQrCodeSuccessSubject = PublishSubject.create()
private val mResponseCreateQrCodeErrorSubject = PublishSubject.create<Any?>()
val onResponseQrCodeSuccess: Observable = mResponseCreateQrCodeSuccessSubject
val onResponseQrCodeError: Observable<Any?> = mResponseCreateQrCodeErrorSubject