RaviKoradiya / Toolbar-Center-Title

A Library for align title on ActionBar.
20 stars 3 forks source link

Memory leak #3

Open paulkugaev opened 5 years ago

paulkugaev commented 5 years ago

Your solution has a memory leak when using databinding. You should either mention that we have to set GlobalLayoutListener to null at every configuration change or remove it from text's viewTreeObserver

saintjab commented 5 years ago

@paulkugaev How did you solve that? I just realised changing configuration keeps calling afterTextChanged method until it crashes the app. I need a solution.

paulkugaev commented 5 years ago

@saintjab the whole code is aimed on reconfiguring toolbar layout after the view tree has been inflated. removing GlobalLayoutListener (which leaks) leads to broken functionality. the easiest workaround - not using this library until @RaviKoradiya fixes the issue and instead creating a regular TextView inside Toolvar coz u can consider Toolbar as a regular FrameLayout