BitmapFactory: Não foi possível decodificar o fluxo: java.io.FileNotFoundException
Estou com um problema relacionado ao BitMapFactory.decodeFile.
No meu aplicativo, desejo que o usuário possa selecionar uma imagem do dispositivo ou tirar uma fotografia. Isso deve ser exibido em um ImageView
Aqui está o trecho de código:
Uri selectedImage = data.getData();
String[] filePathColumn = {MediaStore.Images.Media.DATA};
Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
String picturePath = cursor.getString(columnIndex);
cursor.close();
MyImage image = new MyImage();
image.setTitle("Test");
image.setDescription("test choose a photo from gallery and add it to " + "list view");
image.setDatetime(System.currentTimeMillis());
image.setPath(picturePath);
E eu estou recebendo esta exceção:
BitmapFactory: Unable to decode stream: java.io.FileNotFoundException: /storage/emulated/0/WhatsApp/Media/WhatsApp Images/IMG-20170302-WA0012.jpg: open failed: EACCES (Permission denied)
Como resolvê-lo.Por favor, me ajude.Obrigado antecipadamente ..