I am trying to create ListAdapter for bitmaps stored in assets/
(size of each is about 300k).
I have 1 activity contains GridView, and 2nd is just ImageView.
When I'm picking one of images from 1st activity to show in second Activity and then try to save on filesystem it often throws me OOM(OutOfMemory) or Bitmap exceeds VM budget.
My request is next:开发者_运维技巧
What kind of solution you can suggest to organize Bimaps from assets/
for using via ListAdapter?
One trick you can use to reduce the memory requirements is to pass options to the BitmapFactory decode method you're using. In the options, set inSampleSize to 2 or 4 to cut the number of pixels by a factor of 4 or 16 respectively. See: http://d.android.com/reference/android/graphics/BitmapFactory.Options.html#inSampleSize
Also make sure to call Bitmap.recycle() on bitmaps you don't need any more. This will free up native memory faster than waiting for it to be garbage collected.
精彩评论