Can't Find The Leak, On My Fragment Android Code
Solution 1:
Note to others: the poster and I had an off-SO discussion about this issue, and the poster created this sample app that was able to reproduce the problem.
After some struggling, I was able to get LeakCanary to work. It required 1.4-beta1
versus the shipping 1.3.1
. All I needed to do was add the dependencies and set up an Application
subclass per the LeakCanary
docs. Then, launch the app and press BACK once the activity appears.
You get:
Whether this is a framework bug or something introduced by appcompat-v7
and its specific subclass of MultiAutoCompleteTextView
, I can't say at present. However, it is definitely not a bug in your code.
Clearing the adapter from the MultiAutoCompleteTextView
(setAdapter(null)
) in onDestroyView()
of the fragment should prevent it from leaking the activity, but the widget itself will still leak. A quick scan of the relevant code does not give me much hope that the leak itself can be fixed without modifications to either the framework (for MultiAutoCompleteTextView
) or appcompat-v7
(for its subclass).
Post a Comment for "Can't Find The Leak, On My Fragment Android Code"