Я пытаюсь изменить размер растрового изображения, и во время рабочего процесса это исключение блокирует меня.
Что с этим не так?
public Bitmap decodeSampledBitmapFromUri(Uri fileUri, int reqWidth, int reqHeight) {
InputStream stream = null;
try {stream = new BufferedInputStream(mApplicationContext.getContentResolver().openInputStream(fileUri)); } catch (FileNotFoundException e) {Log.e("TAG","InputStream stream is null");}
try { stream.mark(stream.available()); } catch (IOException e) {Log.e("TAG","Thrown IOException in stream.mark(stream.available()");}
if (stream == null) {Log.e("TAG","stream is null");}
BitmapFactory.Options options = new BitmapFactory.Options();
// First decode with inJustDecodeBounds=true to check dimensions
options.inJustDecodeBounds = true;
try {stream.reset(); } catch (IOException e) {Log.e("TAG","Thrown IOException in stream.reset() 1");}
BitmapFactory.decodeStream(stream, null, options);
try {stream.reset(); } catch (IOException e) {Log.e("TAG","Thrown IOException in stream.reset() 2");}
options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight);
options.inJustDecodeBounds = false;
try {stream.reset(); } catch (IOException e) {Log.e("TAG","Thrown IOException in stream.reset() 3");}
BitmapFactory.decodeStream(stream, null, options);
// Decode bitmap with inSampleSize set
try {stream.reset(); } catch (IOException e) {Log.e("TAG","Thrown IOException in stream.reset() 4");}
return BitmapFactory.decodeStream(stream, null, options);
}
05-16 16:31:14.621 com.example.xxx E/TAG: Thrown IOException in stream.reset() 4
05-16 16:31:14.621 com.example.xxx D/skia: --- SkAndroidCodec::NewFromStream returned null
Любой намек на этот вопрос? Я использую Android 8