FILENOTFOUNDEXCEPTION摄像机意图 - Android



此相机是否将文件保存到Imageuri?我从这里去此代码:如何拍照,保存并将照片放在Android

Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
imageUri = Uri.fromFile(new File(Environment.getExternalStorageDirectory(),
    "fname_" + String.valueOf(System.currentTimeMillis()) + ".jpg"));
intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, imageUri);
startActivityForResult(intent, CAMERA_REQUEST);

在OnActivityResult()...

else if ((requestCode == CAMERA_REQUEST) && (resultcode == -1)) {
    Uri selectedImage = imageUri;
    mProfilePicPath = selectedImage.toString();
    mPortraitPhoto = ih.decodeSampledBitmapFromImagePath(mProfilePicPath, 
        GlobalConstants.PROFILE_PICTURE_RESOLUTION, 
        GlobalConstants.PROFILE_PICTURE_RESOLUTION);

mprofilepicpath不是有效的文件路径(找不到)。

要获得图像的路径,您需要使用另一种uri方法:

mProfilePicPath = selectedImage.getPath();

最新更新