Enlarging pictures programmatically in Android
android, android-image, android-imageview, bitmap
Solution
Bitmap bitmapOrg = BitmapFactory.decodeResource(getResources(),R.drawable.tedd);
int width = bitmapOrg.getWidth();
int height = bitmapOrg.getHeight();
int newWidth = 200;
int newHeight = 200;
// calculate the scale - in this case = 0.4f
float scaleWidth = ((float) newWidth) / width;
float scaleHeight = ((float) newHeight) / height;
Matrix matrix = new Matrix();
matrix.postScale(scaleWidth, scaleHeight);
matrix.postRotate(x);
// this will create image with new size
Bitmap resizedBitmap = Bitmap.createBitmap(bitmapOrg, 0, 0,width, height, matrix, true);
iv.setScaleType(ScaleType.CENTER);
iv.setImageBitmap(resizedBitmap);
Problem
I am able to retrieve the pictures from my phone and store them in an array. After that I am displaying them on the screen. But they are all in diffrent shapes and sizes. I want to display them all in the same size and shape. Any idea? ``` photoPaths = new ArrayList<String>(); getAllPhotos(Environment.getExternalStorageDirectory(), photoPaths); images = new Bitmap[photoPaths.size()]; apa = (AnimationPhotoView)findViewById(R.id.animation_view); for(int i=0;i<photoPaths.size();i++) { File imgFile = new File(photoPaths.get(0)); if(imgFile.exists()) { images[0] = decodeFile(imgFile);} ```