I have an if-else script where if-path uses this code:
BitmapFactory.Options options = new BitmapFactory.Options();
options.inScaled = false;
options.inPurgeable = true;
options.inInputShareable = true;
bitmap = BitmapFactory.decodeResource(getResources(), resourceId, options);
And else-path uses this code:
InputStream is = getContentResolver().openInputStream(Uri.fromFile(file));
BitmapFactory.Options options = new BitmapFactory.Options();
options.inScaled = false;
options.inPurgeable = true;
options.inInputShareable = true;
bitmap = BitmapFactory.decodeStream(is, null, options);
Now to me, reading a short description from the API, testing and Googling, I can not understand the difference, but there seems to be a subclass.
The first part of the code is scaled to fit the width of the screen when applied to ImageView (inside RelativeLayout, in ScrollView). The second piece of code is not, this is my problem. It seems like it will also lose aspect ratio, because if I apply:
imageView.setAdjustViewBounds(true);
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
He manages to fit it in width, but spoil the height (making it shorter than it should be). Any entry is welcome!
( , , - , if-path :)
BitmapFactory.Options options = new BitmapFactory.Options();
options.inScaled = false;
options.inPurgeable = true;
options.inInputShareable = true;
bitmap= BitmapFactory.decodeStream(getResources().openRawResource(resourceId), null, options);