I'm using a ViewPager with 13 pages. It is managed using a FragmentStatePagerAdapter, and each page loads 250ko images as backgrounds, and sometimes 5 images more per page.
I get extremely often an OutOfMemoryError error and I'm testing my app on a Samsung Galaxy Tab 2, so I guess I'm doing something wrong.
Is there a way to release images which are not used on the life cycles of my Fragments on the ViewPager? Any other idea?
Thanks in advance.
Setting up the
android:largeHeap
totrue
is also extremely useful for this kind of problems.Everything is very well explained and detailed on Displaying Bitmaps in Your UI