I've got a GridView
of many images which are retrieved from the assets folder and decoded from streams. These are typically quite large (to be used elsewhere in the app), but for the GridView need to only be 140dp wide or have a minimum height of 150dp. Which of the options in BitmapFactory.Options
should I use to scale the image to this density/resolution? I'm confused by the many different density options.
Asked
Active
Viewed 285 times
0

Alex Curran
- 8,818
- 6
- 49
- 55
1 Answers
0
For fast retrieval, you should use inSampleSize. It automatically loads a smaller bitmap without first loading the full image into memory.

Ulrich Scheller
- 11,800
- 5
- 28
- 32
-
The issue with this is that I don't know which sample size to use; all the files are of significantly different sizes – Alex Curran Aug 09 '11 at 19:49
-
You can read the image sizes without loading a full image as described here: http://stackoverflow.com/questions/2503628/bitmapfactory-decodestream-returning-null-when-options-are-set/2528718#2528718 – Ulrich Scheller Aug 16 '11 at 15:51