'outofmemoryerror' In The GetView() From Custom BaseAdapter
I have an Activity with a grid layout where display images from SD folders. When I select a folder, all images are added to a String list (clean when folder is changed), and images
Solution 1:
Yes, using images may cause outOfMemory on your device. The allocated memory differs from device to device.
Two approaches:
Use LruCache class to optimize memory usage and caching
http://developer.android.com/training/displaying-bitmaps/cache-bitmap.html
Use Picasso a powerful image downloading and caching library for Android
Solution 2:
This also happens when someone inflate a CustomView like:
inflate(getContext, R.layout.my_custom_view_layout, this)
instead of:
inflate(getContext, R.layout.my_custom_view_layout, null)
Post a Comment for "'outofmemoryerror' In The GetView() From Custom BaseAdapter"