I'am opening camera app on click of a button. And displaying the captured photo in next activity. But the captured photo is rotating by 90 degrees. When I display the image in a view after I capture it, it's orientation is always landscape. Why is the photo not being shown in portrait as is when the photo is taken in portrait mode?
onClick of a button :
Intent i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
i.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(APP_DIR+"/latest.png")));
startActivityForResult(i, CAPTURE_PHOTO_CONSTANT);
Inside onActvityresult:
bmp = BitmapFactory.decodeFile(APP_DIR+"/latest.png");
startActivity(new Intent(this, DisplayActivity.class));
Displaying captured photo:
photoViewRelativeLayout.setBackgroundDrawable(new BitmapDrawable(getResources(), CaptureActivity.bmp));
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…