我想从camera
intent
获取全尺寸图片。我尝试了以下代码,但我的图像尺寸非常小。以下是我的代码
Intent intent=new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent , PICK_IMAGE_REQUEST2);
onActivityResult
代码
if(requestCode == PICK_IMAGE_REQUEST2)
{
//filePath = data.getData();
bitmap = (Bitmap) data.getExtras().get("data");
iv_upload.setImageBitmap(bitmap);
check=true;
// CALL THIS METHOD TO GET THE URI FROM THE BITMAP
filePath = getImageUri(getApplicationContext(), bitmap);
}
答案 0 :(得分:3)
通过执行此操作,您可以按照here
所述获得拇指预览 data.getExtras().get("data");
如果你想要完整的尺寸,你需要创建一个抗冲突的文件名并像这样调用你的意图
Uri photoURI = FileProvider.getUriForFile(this,
"com.example.android.fileprovider",
photoFile);
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);
startActivityForResult(takePictureIntent, REQUEST_TAKE_PHOTO);