android - 如何避免android中的createBitmap()崩溃

标签 android memory bitmap

我在多个地方使用 createBitmap()。有时这个 api 会抛出 OutOfMemoryError() 异常。如何避免这个异常?

我正在使用如下,

createBitamp(width, height, Config.ARGB_8888);

width = 屏幕宽度

height = 屏幕高度

任何帮助将不胜感激。

最佳答案

我在以下 Android 问题单中发布了一些有关如何处理位图的信息。可能对您有帮助:http://code.google.com/p/android/issues/detail?id=8488#c80

关于android - 如何避免android中的createBitmap()崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7823363/

相关文章:

scala - 不变性和内存使用

Delphi - 如何裁剪位图 "in place"?

android - Bitmap、Bitmap.recycle()、WeakReferences 和垃圾回收

java - 如何在 android 中为 Picasso 使用 RoundedImageView

Java/Android 无法解释的编译错误 : is not abstract and does not override abstract method onTabReselected(Tab, FragmentTransaction) in TabListener

java - 将字符串转换为日期对象

c# - WPF 模糊图像

android - 如果 ViewGroup 的子级超出设备宽度,则强制移动到下一行

ruby - 在 Ruby 中,堆栈中存储了什么?

c# - 图像对应用程序内存使用的影响