Slide 2
Slide 2 text
POTATOTIPS #29 (2016-05-25)
1. AVOID NULL CHECK FOR SUBSCRIPTION - SINGLE
private Subscription signInSubscription = null;
private void sendSignInRequest() {
signInSubscription = service.signInUser(new SignInRequest(email, password))
.subscribe(...);
}
@Override
public void onDestroy() {
if (signInSubscription != null) {
signInSubscription.unsubscribe();
}
super.onDestroy();
}
▸ In RxJava, it’s really important to call unsubscribe()
▸ If you forgot it, memory leak would occur