Open TonyEasy opened 6 years ago
public void doHttpDeal(BaseApi basePar) { /链接式对象返回/ SoftReference httpOnNextListener = basePar.getListener(); if (httpOnNextListener != null && httpOnNextListener.get() != null) { httpOnNextListener.get().onNext(observable); }
/*数据回调*/ observable.subscribe(subscriber); }
每次的网络请求都会产生一次订阅关系,如何才能使接口回调回来后,取消本次订阅?
对比其它框架,大神你的retrofit占内存比较高
这个地方是有兄弟提出需要链接式返回才写的,个人并不推荐使用;如果不需要可以直接去掉这里,内存较高主要是ProgressDialog是集成在封装里,所以比其他的Retorift高一点;
public void doHttpDeal(BaseApi basePar) { /链接式对象返回/ SoftReference httpOnNextListener = basePar.getListener();
if (httpOnNextListener != null && httpOnNextListener.get() != null) {
httpOnNextListener.get().onNext(observable);
}
每次的网络请求都会产生一次订阅关系,如何才能使接口回调回来后,取消本次订阅?