Closed Sebsen closed 7 years ago
There's two problems here.
The first, as the exception message indicates, is that you are using the wrong Schedulers
import. io.reactivex.Scheduler
is from RxJava 2.x whereas rx.Scheduler
is from 1.x. You need to import the 1.x version of Schedulers
or fully-qualify the type (rx.Schedulers
).
The second is that every observable in this library requires that you subscribe on the main thread and no other. In your example this amounts to just deleting both subscribeOn
and observeOn
allowing the stream to subscribe synchronously on the main thread and also observe items synchronously on the main thread.
@JakeWharton you mean there is no Subscription in Rx2 right ?
There is but in different package. If you want to make a network call on click you have to use observeOn twice. It is because (as Jake said) RxBinding require subscriptions to execute on main thread.
RxView.clicks(_btn_loadWithRxAndroid)
.observeOn(Schedulers.io())
.switchMap{ call() }
.observeOn(AndroidSchedulers.mainThread())
.subscribe(...);
Hi Anyone can please help me on this Attempt to invoke virtual method 'io.reactivex.Single io.reactivex.Single.subscribeOn(io.reactivex.Scheduler)' on a null object reference at com.dt.admin.newdriver.ui.login.LoginPresenter.onServerLoginClick(LoginPresenter.java:56)
That very much likely indicates null pointer exception in your code.
Moreover it doesn't seem to be related to RxBinding because it's illegal to subscribe on non-Main thread scheduler for all UI (afaik) bindings. (unless view was created on non-main thread originally, but that's advanced stuff)
Hello, first of all I want to say that your Library looks great and I'm glad being able to use it.
Unfortunately I'm getting an error on following line of code:
It says: "subscribeOn( rx. Scheduler) in Observable cannot be applied to ( io.reactivex. Scheduler)"
Am I doing something wrong or is it still under development? I hope you can clear me up or have another workaround for me.
I have every of the rxbinding dependencies included like:
except the leanback-v17 one.