I’ve tried various ways to implement something more creative, such as:
BitmapFactory.Options options = new BitmapFactory.Options ();
options.inJustDecodeBounds = true;
...
to make better prevent the outflow of memory but I had no success. In the end I decided to use
android:largeHeap = "true"
under the tag of my application manifest file, and that solved my problem.
Perhaps this solution is not desirable but is effective.
solved Switch from one Activity to another one results OOM error on Samsung device