maxInfinity
New Member
I want to re size the caputured image. But I am getting the "Android application unfortunately stopped". Below my code-\[code\]private void getResizedBitmap(Bitmap bm, int newHeight, int newWidth) { int scaleWidth = newWidth; int scaleHeight = newHeight; System.out.println("scaleWidth :"+scaleWidth); System.out.println("scaleHeight :"+scaleHeight); // create a matrix for the manipulation Matrix matrix = new Matrix(); // resize the bit map matrix.postScale(scaleWidth, scaleHeight); // recreate the new Bitmap Bitmap resizedBitmap = Bitmap.createBitmap(bm, 0, 0, scaleWidth, scaleHeight, matrix, false); /* Associate the Bitmap to the ImageView */ BitmapDrawable result = new BitmapDrawable(); scaleWidth = resizedBitmap.getWidth(); scaleHeight = resizedBitmap.getHeight(); Log.d("scaleHeight","value"); Log.d("scaleWidth","value"); // Apply the scaled bitmap mImageView.setImageDrawable(result); // Now change ImageView's dimensions to match the scaled image LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) mImageView.getLayoutParams(); params.width = scaleWidth; params.height = scaleHeight; mImageView.setLayoutParams(params); }\[/code\]