Skip to content Skip to sidebar Skip to footer

Android Unable To Get Path For Cloud Image From Photos Application

I have tried to getting absolute path and I got the success too but when I try with the cloud images to get that image and used in application file is not find and getting null. I

Solution 1:

Try getting the Bitmap first:

@OverridepublicvoidonActivityResult(int requestCode, int resultCode, Intent data) {
        UriselectedImage= data.getData();

        InputStreaminputStreamBitmap=null;
        BitmapimageBitmap=null;
        try {
            inputStreamBitmap = getContentResolver().openInputStream(inputStreamBitmap);
            imageBitmap = BitmapFactory.decodeStream(inputBitmap);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } finally {
            try {
                if (inputStreamBitmap != null) {
                    inputStreamBitmap.close();
                }
            } catch (IOException ignored) {
            }
        }
        if (imageBitmap != null) {
            processImageBitmap(imageBitmap);
        } else {
            Log.e("ImageIntent", "Error: couldn't open the specified image.");
        }
    }
}

Then you could save the Bitmap to a temp file if you want to.

More details here.

Post a Comment for "Android Unable To Get Path For Cloud Image From Photos Application"