RxAndroidの新機能です。ボタンのクリックイベントが機能しなくなった理由を理解したいと思います。 ObservablesでRxBindingとRetrofit 2を使用しています。私は(ログイン後付けサービスからの)エラーを得た場合RxAndroid onErrorの後にボタンのクリックリスナーが機能しなくなる
Subscription loginButtonSubscription = RxView.clicks(loginBtn)
.throttleFirst(Constants.CLICK_THRESHOLD_MILLIS, TimeUnit.MILLISECONDS)
.flatMap(aVoid -> authApi.login(new LoginUserRequest(emailEditText.getText().toString(), passwordEditText.getText().toString())))
.observeOn(AndroidSchedulers.mainThread())
.subscribe(verifyEmailResponse -> Log.i("TEST", "onNext: " + verifyEmailResponse.success),
throwable -> handleError(throwable));
メソッドhandleErrorのは、細かい実行されますが、その後、クリックイベントはもう発生しません。
私は何か間違っていますが、私は理解できません。改造誤差を処理するより良い方法はありますか?
おかげ
このhttp://stackoverflow.com/questions/40305865/onnext-onerror-callbacks-not-executing-on-second-subscribtionに見てみましょう-android/40313481#40313481 –
私はチェックしましたが解決策ではありません。 – AndroidRuntimeException
です。 OnErrorは、ObservableソースでOnCompleteを呼び出しているため、あなたのサブスクリプションはそれ以上は機能しません。そして、PublishSubjectはそれをしません。 –