裁剪Android后无法检索图像

裁剪Android后无法检索图像,android,crop,Android,Crop,裁剪后我无法检索图像,这是我的代码,一切都正确吗???我只是想从gallery中裁剪一幅图像,然后将其上传到ImageView Intent intent = new Intent(); // call android default gallery intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); // ******** code for crop image intent.putExtra

裁剪后我无法检索图像,这是我的代码,一切都正确吗???我只是想从gallery中裁剪一幅图像,然后将其上传到ImageView

Intent intent = new Intent();
 // call android default gallery
 intent.setType("image/*");
 intent.setAction(Intent.ACTION_GET_CONTENT);
 // ******** code for crop image
 intent.putExtra("crop", "true");
 intent.putExtra("aspectX", 1);
 intent.putExtra("aspectY", 1);
 intent.putExtra("outputX", 400);
 intent.putExtra("outputY", 400);
 intent.putExtra("scale", true);
 intent.putExtra("scaleUpIfNeeded", true);
 intent.putExtra(MediaStore.EXTRA_OUTPUT, "image");
 intent.putExtra("outputFormat", Bitmap.CompressFormat.PNG.toString());

 try {
     intent.putExtra("return-data", false);
    startActivityForResult(Intent.createChooser(intent, "Complete action using"), PICK_FROM_GALLERY);
 }

 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == RESULT_OK) {
        if (requestCode == PICK_FROM_GALLERY) {
            Bundle extras2 = data.getExtras();
            if (extras2 != null) {
                photo = extras2.getParcelable("image");
                attachimage.setImageBitmap(photo);
            }
         }

         if (requestCode == PICK_FROM_CAMERA) {
            Bundle extras = data.getExtras();
            if (extras != null) {
                photo = extras.getParcelable("data");
                attachimage.setImageBitmap(photo);
            }
        }
    }
}
由于此原因,您没有从活动中接收数据

编辑(尽管有评论): 那么您就做错了,例如,当您请求其他输出时,为什么要从bundle读取数据?
看看这个问题和答案:

什么是应对?复制?@JaredBurrows他的意思是剪切剪切剪切,很抱歉搞错了很难说什么有效,什么无效,你只发布了部分代码。我想从这个目的中检索数据。putExtra(MediaStore.EXTRA_OUTPUT,“image”);
intent.putExtra("return-data", false);