RxJava2 get event when Observable/Completed is completed or disposed
I need to show a progress dialog when I subscribe to a Completable and hide it after the operation is completed(successfully or with an error) or is canceled. So I do final Completable completable = notificationRepository.markAllAsRead() .doOnSubscribe(d -> progressDialog.show()) .doOnError(error -> progressDialog.dismiss()) .doOnComplete(() -> progressDialog.dismiss()) .doOnDispose(() -> progressDialog.dismiss()); Is there any elegant way to get single callback when onError , onComplete or onDispose happens? Rostyslav Roshak I have done some tests, so doOnDispose is called when the subscriber