在尝试从Assest加载位图图像时,我正面对外部内存,下面是我的代码:
AssetManager assetManager = context.getAssets();
InputStream istr = assetManager.open(FILE_NAME);
bitmap = BitmapFactory.decodeStream(istr);大多数时候,我在加载图像时,都会出现异常情况:
错误/ exceeds运行时(731):java.lang.OutOfMemoryError:位图大小超过VM预算
我几乎没有在ImageView中发表过关于管理图像大小的文章。但我的代码甚至还没达到那个程度。
请帮帮忙
发布于 2013-07-30 01:08:02
我想决议是很大的。
您应该先读取大小,然后再将其加载到内存中。
这方面的最佳实践
高效加载大型位图
发布于 2013-07-30 05:32:52
只需将以下代码添加到清单中即可
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:theme="@style/AppTheme" />https://stackoverflow.com/questions/17936746
复制相似问题