Мне нужно чтобы юзер нажал на кнопку перешел в галерею выбрал изображения и он вставился в ImageView. На эмуляторе все окей но при работа на устройстве Galaxy J1Ace android 4.4.4 если для выбора приложения выбрать "Фото" то все окей но стоит мне выбрать "Галерея" то меня выкидывает не могу понять почему. Вот код приема результата активити:
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch(requestCode) {
case 1234:
if(resultCode == RESULT_OK){
Uri selectedImage = data.getData();
final InputStream imageStream;
try {
imageStream = getContentResolver().openInputStream(selectedImage);
final Bitmap selectedImages = BitmapFactory.decodeStream(imageStream);
ImageView img = (ImageView) findViewById(R.id.img);
img.setImageBitmap(selectedImages);
} catch (FileNotFoundException e) {
TextView txt = (TextView) findViewById(R.id.txt);
txt.setText("FileNotFoundException");
}
}
}
};
Что скажете?