PhotoView icon indicating copy to clipboard operation
PhotoView copied to clipboard

Memory leak with PhotoViewAttacher in API < 16

Open bastienvalentin opened this issue 12 years ago • 1 comments

Hi, First of all thank you for your amazing work. I'm currently facing a memory issue with this component on device with an API level < 16. Indeed , to know the size of the imageView inside the PhotoViewAttacher you must use a globalLayoutListener. This works great and at the end you use a method (not the cleanup method which is deprecated but still) removeOnGlobalListener which is fine but only on API level < 16 because this method is add at this level.

Can you change your code to make it works on previous version. A hint to do this is to extends ImageView class and override the onSizeChanged method. With this solution you can get the size even with API level < 16.

Kind regards BASTIEN Valentin

bastienvalentin avatar May 20 '14 14:05 bastienvalentin

My mistake I misread the code. It is removeGlobalOnLayoutListener in the code and not removeOnGlobalLayoutListener. Problem solved. Sorry for the inconvenience.

Kind regards BASTIEN Valentin

bastienvalentin avatar May 20 '14 15:05 bastienvalentin