But even then, the logout works if I don’t go to C...
# rx
r
But even then, the logout works if I don’t go to CheckInClientActivity but if I go there and return to the home activity where the logout button resides, then the logout doesn’t work (nothing happens really.. as if there was no action to confirming logout through the dialog)
g
Not sure what is your problem and how it can be related to rxjava. Looks like some bug. Maybe you dispose some subscription onDestroy or maybe just something wrong with activity onResume, cannot say nothing particular without code and use case
r
@gildor, by
onDestroy
, you mean I should call it anywhere else?
Because I have it like this
override fun onDestroy() { disposeBag.clear() super.onDestroy() }
g
Yes, you should dispose subscriptions after onDestroy
r
after
super.onDestroy
?
g
Actually, I mean onStop, not onDestroy
of course, you must dispose onDestroy, otherwise you will get leak
no difference in this case
r
So, is this correct, right?
override fun onDestroy() { disposeBag.clear() super.onDestroy() }
Actually, I mean onStop, not onDestroy
g
Yes, but I don’t see how you problem could be related to rx, maybe I don’t understand your case, but looks like you have some activity navigation, and you cannot use rx events between activities or persist chain of operations
yes, you must dispose in onDestroy, or you can do that in onStop, depends on your case,. but with onStop you can cancel some operations while activity minimized
r
got you
@gildor, I discovered what was crashing
For some reason I still don’t comprehend
After retrieving some data from the db using room and rxjava2 in CheckInClientActivity, if the array was empty (but it could be any arbitrary condition) I would show a dialog
For some reason, after I pressed the back button (and the activity got destroyed) and even when this condition was not met so that the dialog was not shown, it still caused the crash. After I removed the calling of the dialog from the subscribe method, it worked
Btw, the crash happened whenever I logged out such that the flow in activites would be like this
HomeActivity (launch screen/automatic login) -> CheckInClientActivity -(back press)--> HomeActivity ----LogOut()--*-> LoginActivity
*= crash