We have Activities and Fragments leaking and have traced the cause back to what appears to be un-removed ChangeWatchers on TextViews.
Scenario: Activity A starts Activity B. B has a textPassword EditText field in its layout. Activity B finishes.
The HPROF dump shows that there is still one instance of Activity B. Its gcroot path is the following:
test.maa.LoginActivity
'- mContext android.widget.EditText
'- this$0 android.widget.TextView$ChangeWatcher
'- [1] java.lang.Object[13]
'- mSpans android.text.SpannableStringBuilder
'- mSource android.text.method.PasswordTransformationMethod$PasswordCharSequence
'- mText android.text.MeasuredText
'- mMeasured android.text.StaticLayout
'- sStaticLayout class android.text.DynamicLayout
This also happens if you Linkify.addLinks to a TextView.
Is there any way to clean up Activity B?