Ad

Android Dialog + Leak Canary

I was trying to use built-in AlertDialog with onDismiss listener (without it result was same) and custom AppCompatDialog subclass. After dialog dismissed, current activity should finish. But few seconds later memory leak push appears. If I put breakpoint in custom dialog's onStop() method (delay is don't matter), this memory leak caption is not shown. Can it be fixed in normal way? Maybe, someone already faced with a similar problem? stack content

Ad

Answer

This memory leak was related to displaying toast with current activity's context. When I injected application context into class, that displaying toasts, leak was fixed

Ad
source: stackoverflow.com
Ad