Bitmap - Out of memory exception

前端 未结 5 1974
抹茶落季
抹茶落季 2021-01-25 04:46

When I try to get image from camera or gallery, I get error. Here is a part of logcat:

06-27 05:51:47.297: E/dalvikvm-heap(438): Out of memory on a 35295376-byte         


        
5条回答
  •  难免孤独
    2021-01-25 05:08

    Do not use strong references for bitmaps. Use it as below. Always Use weakreferences so that system can gc the object and reduce the memory leaks

    WeakReference bitmapSelectedImage ;
    

提交回复
热议问题