3

I use Retrofit with RxAndroid to handle couple of requests in one Activity,

So I have couple subscription variables in the activity as public,

public Subscription sub1;
public Subscription sub2;
public Subscription sub3;
public Subscription sub4;
public Subscription sub5;

now in the onStop of the activity I want to cancel them all (if they did not finish).

Is there any way that we can cancel or unsubscribe all of them at once ?

MBH
  • 16,271
  • 19
  • 99
  • 149

1 Answers1

5

You can add them into a CompositeSubscription and unsubscribe it in onStop.

zsxwing
  • 20,270
  • 4
  • 37
  • 59