use of io.reactivex.subscribers.DisposableSubscriber in project RxJava-Android-Samples by kaushikgopal.
the class VolleyDemoFragment method startVolleyRequest.
private void startVolleyRequest() {
DisposableSubscriber<JSONObject> d = new DisposableSubscriber<JSONObject>() {
@Override
public void onNext(JSONObject jsonObject) {
Log.e(TAG, "onNext " + jsonObject.toString());
_log("onNext " + jsonObject.toString());
}
@Override
public void onError(Throwable e) {
VolleyError cause = (VolleyError) e.getCause();
String s = new String(cause.networkResponse.data, Charset.forName("UTF-8"));
Log.e(TAG, s);
Log.e(TAG, cause.toString());
_log("onError " + s);
}
@Override
public void onComplete() {
Log.e(TAG, "onCompleted");
Timber.d("----- onCompleted");
_log("onCompleted ");
}
};
newGetRouteData().subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(d);
_disposables.add(d);
}
Aggregations