I want to call request when user click button. But when first request not response , user want to change parameter and call new request with same url.
Problem How to cancel first request and call new request with same url.
ServiceFactory
.createService()
.getSomething(page)
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribeWith(new DefaultObserver<SomthingResponse>() {
@Override
public void onNext(@NonNull SomthingResponse response) {
showSomthing()
hideProgressDialog();
}
@Override
public void onError(@NonNull Throwable e) {
hideProgressDialog();
showErrorMessage(e.getMessage());
}
@Override
public void onComplete() {
}
});
when user click button user will send page parameter to query string but this request have not already finish. User will change to page parameter and send new request. I want to cancel first request.
Thankyou