Handle Android Out of memory exception (个人总结的如何应对Android内存不足)

1.http://blog.jteam.nl/2009/09/17/exploring-the-world-of-android-part-2/


2.Recycle Drawable:

  Drawable.setCallback(null)

 

  View.unscheduleDrawable(who)

  BitmapDrawable.getBitmap().recycle()

 


3.New a thread to decode in background


4. Cache drawable(bitmap) (limit to a number) and Recycle bitmap when out of current cache scope.


ImageView.setImageBitmap(null)

bitmap.recycle()

bitmap = null

 

 

 

此处有个好贴,全面介绍了如何应对内存问题。

 

你可能感兴趣的:(Handle Android Out of memory exception (个人总结的如何应对Android内存不足))