I want to create a new bitmap with a defined size, for example 200x200
Bitmap b = Bitmap.createBitmap(200, 200, Bitmap.Config.ARGB_8888);
Now my understanding is to put inside that bitmap an image of the sd card, but adjusting the image of the SD to the size of the bitmap I created.
Do what I can do with an ImageView using:
<ImageView android:src="@drawable/landscape"
android:adjustViewBounds="false" />
The result that I look for is the following:
Thanks in advance.
EDIT: post my code
public static Bitmap decodeSampledBitmapFromResource(Resources res, int resId, int reqWidth, int reqHeight) {
// First decode with inJustDecodeBounds=true to check dimensions
final BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = false;
BitmapFactory.decodeResource(res, resId, options);
// Calculate inSampleSize
// options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight);
// Decode bitmap with inSampleSize set
options.inJustDecodeBounds = false;
return BitmapFactory.decodeResource(res, resId, options);
}
--
imageView.setImageBitmap(decodeSampledBitmapFromResource(getResources(), R.drawable.paisaje, 200, 200));