25 Aralık 2017 Pazartesi

RxJava Subscription Sınıfı

constructor
Şöyle yaparız.
Subscription subscription =  Observable.subscribe(new Subscriber<Type>() {
  @Override
  public void onCompleted() {
  }

  @Override
  public void onError(Throwable e) {
  }

  @Override
  public void onNext(String responseString) {
  }
});
isUnsubsribed metodu
Şöyle yaparız.
if(subscription!=null && !subscription.isUnsubscribed()){
      //Cancel(unSubscribe) the request if running(not completed)
      subscription.unsubscribe();
      //START A NEW REQUEST HERE
 }else{
      //already completed so START A NEW REQUEST
 }

Hiç yorum yok:

Yorum Gönder