0

I need to show 1000 images in viewpager from DB.The problem is if I fetch all images from DB and try to set those images to adapter,it shows Bitmap out of memory exception since heap size gets exceeded. So,I'm trying other way around which is to load images one by one when the user swipes to next page.I Googled a bit,but didn't find any appropriate solution.so any input on this is highly appreciated.

Vijay
  • 11
  • 3

1 Answers1

0

Here is all that you need : http://developer.android.com/training/displaying-bitmaps/index.html

Load Bitmaps efficiently, LRU cache, etc. etc.

To summarize, you should fetch one bitmap at a time, scale it down using inSampleSizeand use LRUCache. OR, you can use http://code.tutsplus.com/tutorials/android-sdk-working-with-picasso--cms-22149 library

Ankur Aggarwal
  • 2,210
  • 2
  • 34
  • 39