I'm cropping midi-resolution images in Android (doing a crop). One of the customers requirement is to do a 'Best Effort' in that.
I'm using
croppedImage = decoder.decodeRegion(rect, o);
Where o is my BitmapFactory.Options. This line sometimes is launching an
'External allocation too large for this process /VM won't let us allocate XXXXXXX bytes' sometimes when I'm using as a PreferredConfig a Config.ARGB_8888'
I'm trying to catch that in order to retry cropping with Config.RGB565, that never has memory problem, but changes the color profile of the image.
How could I catch this (I've already tried by catching any Throwable object). If that is not possible I would like to pre-suposse memory problems and decodeRegion with RGB_565 directly, but I don't know how to do that.