catch OutOfMemory errors at saving images
This commit is contained in:
parent
95e75b4e74
commit
16d6d2044d
|
@ -83,7 +83,11 @@ class PhotoProcessor(val activity: MainActivity, val uri: Uri?, val currCameraId
|
|||
} else {
|
||||
matrix.preScale(-1f, 1f)
|
||||
}
|
||||
try {
|
||||
image = Bitmap.createBitmap(image, 0, 0, image.width, image.height, matrix, false)
|
||||
} catch (e: OutOfMemoryError) {
|
||||
activity.toast(R.string.out_of_memory_error)
|
||||
}
|
||||
}
|
||||
|
||||
image.compress(Bitmap.CompressFormat.JPEG, activity.config.photoQuality, fos)
|
||||
|
@ -140,8 +144,10 @@ class PhotoProcessor(val activity: MainActivity, val uri: Uri?, val currCameraId
|
|||
|
||||
override fun onPostExecute(path: String) {
|
||||
super.onPostExecute(path)
|
||||
if (path.isNotEmpty()) {
|
||||
activity.mediaSaved(path)
|
||||
}
|
||||
}
|
||||
|
||||
interface MediaSavedListener {
|
||||
fun mediaSaved(path: String)
|
||||
|
|
Loading…
Reference in New Issue