简体   繁体   中英

what is the best way to save memory while going back and forth between different activities that use bitmaps

This application has MainActivity and it uses about 20 bitmaps. It works pretty fine but when I start an intent to another activity and then go back to the MainActivity, it crashes because of memory problem. It gives this error:

java.lang.OutOfMemoryError: Failed to allocate a 2052108 byte allocation with 1629176 free bytes and 1590KB until OOM

I have also used these in the manifest

android:hardwareAccelerated="false"
android:largeHeap="true"

What would be the best method to be able to switch between Activities without using more memory? Thanks

当不再使用时,您只需回收位图

myBitmap.recycle();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM