• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps camera app issue

i try take camera and scale image on screen size set as background . but 5mp and 4mp camera images pixel late .whats wrong my code.

Bitmap bitmapOrg = (Bitmap) intent.getExtras().get("data");
int twidth = bitmapOrg.getWidth();
int theight = bitmapOrg.getHeight();
// System.out.println(bitmapOrg.getDensity());
int newWidth = width;
int newHeight = height-50;
// Bitmap scaledImage =
Bitmap.createScaledBitmap(bitmapOrg, newWidth, newHeight, false);
System.out.println(twidth+"--"+theight+"--"+width);
// calculate the scale - in this case = 0.4f
float scaleWidth = ((float) newWidth) / (twidth);
float scaleHeight = ((float) newHeight) / (theight);
System.out.println(scaleWidth+"--"+scaleHeight);
// createa matrix for the manipulation
Matrix matrix = new Matrix();
// resize the bit map
matrix.postScale(scaleWidth, scaleHeight);
// rotate the Bitmap
if(twidth>theight)
matrix.postRotate(90);


// recreate the new Bitmap
Bitmap resizedBitmap = Bitmap.createBitmap(bitmapOrg, 0, 0,twidth, theight, matrix, true);


mView.setBackgroundDrawable(new BitmapDrawable(getBaseContext().getResources(), resizedBitmap));


am using Android 2.2 froy os. pleasa help me
 
Back
Top Bottom