Thanks to Schermvlieger for asking this question on anddev.org,
I'm just copying his question to SO as nobody replied on the other site and I'm also facing the same problem.
I was wondering what would be the optimal use of BitmapFactory.Options.inSampleSize with regards to speed of displaying the image.
The documentation mentions using values that are a power of 2, so I am working with 2, 4, 8, 16 etc.
The things I am wondering about are:
- Should I resample down to the smallest size that is still larger than the screen resolution, or should I sample down to the size just enough to avoid an
OutOfMemoryError? - How would one calculate the maximum size of an image that could still be displayed without running out of memory? Does the color-depth of the image play a role as well, and the depth of the display?
- Is it efficient to display images via two mechanisms (
BitmapFactoryfor large files,setImageURI()for smaller ones) I am using anImageSwitcherby the way. - Would it help creating the
Bitmap,BitmapFactory.OptionsandinTempStoragein the beginning of the application or creating them only on the fly, when needed?