有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java Google+4.3及以上版本无法访问“/storage/emulated/legacy/”,以从中裁剪图像

在我的安卓应用程序中,我要求“谷歌+照片应用程序”在路径下裁剪图像

`file:///storage/emulated/0/myApp/ProfileImageCapture.tmp``

然后我要求它将裁剪后的图像保存到/storage/emulated/0/myApp/ProfileImage.tmp 我用的是Nexus 5和安卓4.4.2

这是我的密码

  // Crop and resize the image for profile
  private void cropImage(Uri imageCaptureUri) {
    // Use existing crop activity.
    Intent intent = new Intent("com.安卓.camera.action.CROP");
    intent.setDataAndType(imageCaptureUri, AccountSignInDetails.IMAGE_UNSPECIFIED);

    // Specify the output path
    File imageFile =
        new File(ResManager.mAppDir, AccountSignInDetails.PROFILE_IMAGE_FILE);
    intent.putExtra("output", Uri.fromFile(imageFile));

    // Specify image size
    intent.putExtra("outputX", 100);
    intent.putExtra("outputY", 100);

    // Specify aspect ratio, 1:1
    intent.putExtra("aspectX", 1);
    intent.putExtra("aspectY", 1);
    intent.putExtra("scale", true);
    intent.putExtra("return-data", true);
    mActivity.startActivityForResult(intent, ImageTaker.REQUEST_CODE_CROP_PHOTO);
  }

在哪里

imageCaptureUri = file:///storage/emulated/0/myApp/ProfileImageCapture.tmp

imageFile = /storage/emulated/0/myApp/ProfileImage.tmp

任何其他裁剪者都可以访问此路径

但“Google plus cropper”显示了其他图像(我猜这是它能访问的最后一张图像)

这种情况只发生在谷歌+4.3及以上版本上

返回到4.2,裁剪者设法获得了照片

没有指示性logcat错误

我怎样才能解决这个问题


共 (0) 个答案