Question

Does this camera intent save the file to imageUri? I go this code from here: How to take a photo, save it and get the photo in 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);

within 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 is not a valid file path (it is not found).

Was it helpful?

Solution

In order to get the path to the image, you need to use another method of Uri :

mProfilePicPath = selectedImage.getPath();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top