我正在构建一个应用程序,我必须启动相机,拍照并将照片发送到另一个活动进行编辑。但是在接收活动中,图片模糊不清,当我将 Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, CAM_REQUEST);
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(data != null) {
if (requestCode == CAM_REQUEST) {
Bitmap thumbnail = (Bitmap) data.getExtras().get("data");
Intent intent = new Intent();
intent.setClass(MainLayout.this, MainActivity.class);
intent.putExtra("TakenPhoto", thumbnail);
startActivity(intent);
}
}else{
Intent intent = new Intent();
intent.setClass(MainLayout.this, MainLayout.class);
startActivity(intent);
}
}
照片发送给编辑时,照片会变小。
如何才能获得保存在图库中的确切照片?
以下是启动相机并将照片发送到其他活动的代码:
thumbnail = (Bitmap)this.getIntent().getParcelableExtra("TakenPhoto");
if(thumbnail != null){
String path = MediaStore.Images.Media.insertImage(getContentResolver(),thumbnail,"Title",null);
myUri = Uri.parse(path);
setImageURI(myUri,thumbnail);
}
private boolean setImageURI(final Uri uri, final Bitmap bitmap) {
mImage.setImageBitmap(bitmap);
mImage.setBackgroundDrawable(null);
mEditButton.setEnabled(true);
mImageUri = uri;
return true;
}
接收活动:
Break