java.lang.OutOfMemoryError

后端 未结 1 1199
误落风尘
误落风尘 2021-01-29 15:25

I take an image with camera an store it in the sd card, the image stored must be upload from sd card to an imageView like that:

myBitmap = BitmapFactory.decodeFi         


        
相关标签:
1条回答
  • 2021-01-29 15:43

    Using BitmapFactory in mobile is a memory consuming process. This problem will arise when you are trying to decode a lot of images continuously. As in java there is no option to free the memory allocated to the variable " myBitmap ". So make sure that these types of variables are set to null after using it.

    Also try to use

    System.gc() to clear the garbage collection.
    

    If an error is thrown while executing "_image.setImageBitmap(myBitmap);" line then try to reduce the image size before displaying

    0 讨论(0)
提交回复
热议问题