在我的应用程序中,用户有机会拍照,然后在 ImageView 中查看。问题是查看照片时的图像变成 90 dregrees(如果我拍摄肖像,它会出现在风景中)。我究竟做错了什么??
拍照片:
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
File file = new File(Environment.getExternalStorageDirectory(), "/PROJETOS/"+nome+"/"+"proj"+id+"_reg"+id_reg+"_"+valor+".jpg");
nome_caminho = "proj"+id+"_reg"+id_reg+"_"+valor+".jpg";
outputFileUri = Uri.fromFile(file);
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
startActivityForResult(intent, TAKE_PICTURE);
protected void onActivityResult(int requestCode, int resultCode, Intent data){
if (requestCode == TAKE_PICTURE){
mydb.execSQL("INSERT INTO fotos(id_regi,nome,caminho) VALUES('"+id_reg+"','"+nome_caminho+"','"+outputFileUri+"')");
}
查看它:
Options op = new Options();
op.inSampleSize = 5;
op.inJustDecodeBounds = false;
bm = BitmapFactory.decodeFile(caminhoNovo, op);
foto.setImageBitmap(bm);