I have an app that has a separate toolbar
for each Fragment
. Then the app sets it into Activity with setSupportActionBar
method. Apparently this causes Fragment layout to leak after onDestroyView
.
What I have tried is
setting
activity.setSupportActionBar(null)
which cause issues sinceNavigation
library has following sequence of events: new Fragment is created and old calls onDestroyView. So putting the above code in onDestroyView causes thesupportActiobBar
to be null.considered having one toolbar which is not easy since requires major refactoring and this is not my personal project.
setting
toolbar
to null. Doesn't work causeViewBinding
doesn't allow that.
The questions is - is there any other way to mitigate the memory leak in this case.