/**
* 网络请求的封装
*/
protected <M> void request(Observable<M> api, OnRespListener<M> listener){
api.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<M>(http://www.amjmh.com/v/BIBRGZ_558768/) {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(M value) {
listener.onSuccess(value);
}
@Override
public void onError(Throwable e) {
listener.onFailed(e);
}
@Override
public void onComplete() {
}
});
}
public interface OnRespListener<M>{
void onSuccess(M value);
void onFailed(Throwable e);
}
---------------------