/**
* Bitmap 工具包
* @author Thunder
* @version
* @2012-8-24
*/
public class BitmapUtil {
private static BitmapFactory.Options mOptions = null;
static {
mOptions = new BitmapFactory.Options();
mOptions.inJustDecodeBounds = false;
// options.inSampleSize = 10; //width,hight设为原来的十分一
mOptions.inPreferredConfig = Bitmap.Config.RGB_565; // 这里也可以是ARGB_8888
mOptions.inPurgeable = true;
mOptions.inInputShareable = true;
}
/**
* 获取Bitmap
* @param assetManager
* @param src
* @return
*/
public static Bitmap getBitmap(AssetManager assetManager, String src) {
Bitmap temp = null;
try {
temp = BitmapFactory.decodeStream(assetManager.open(src), null, mOptions);
} catch (IOException e) {
e.printStackTrace();
return temp;
}
return temp;
}
分享到:
相关推荐
ANDROIDBITMAP内存限制OOM,OUTOFMEMORY.pdf
通过压缩Bitmap来避免OOM,相关博文:http://www.cnblogs.com/tianzhijiexian/p/4254110.html
ANDROIDBITMAP内存限制OOM,OUTOFMEMORY[文].pdf
详情请参照 http://blog.csdn.net/gdp2852/article/details/7027162
安卓在加载大图的时候经常会出现oom的错误,给大家分享我的一些处理经验。 这个是优化后的版本。
处理bitmap内存溢出问题
安卓在加载大图的时候经常会出现oom的错误,给大家分享我的一些处理经验。这是2.0版本。解决上个版本再次使用recycle bitmap的bug。
可将TIF或TIFF格式的传真图片转换成bitmap读取出来 经实际测试, 可以查看TIFF或TIF格式的图片. 请放心下载
安卓在加载大图的时候经常会出现oom的错误,给大家分享我的一些处理经验。这个版本关闭了硬件加速。
怎么解决OOM,通常OOM都发生在需要用到大量内存的情况下(创建或解析Bitmap,分配特大的数组等),在这样的一种情况下,就可能出现OOM,据我现在了解到,多数OOM都是因为Bitmap太大。所以,这里我就专门针对如何解决...
This program is designed specifically for reading 24bit Bitmap, other bitmap varying the bits per pixel needs altering. The structure's detailed information can be found at Wikipedia's BMP file format...
对设备无关位图(DIB)进行读取,保存,显示。
android bitmap outofMemory 用来解决android中常见的bitmap outOfMemory
public Bitmap decodeSampledBitmapFromResource(Resources res, int resId, int reqWidth, int reqHeight) { // First decode with inJustDecodeBounds=true to check dimensions final BitmapFactory.Options ...
Android 内存 OOM 优化和治理,Android 内存泄漏原因详解与应对措施,Android 中的 Bitmap 使用详解,Android 中的 Bitmap 内存治理和优化详解,Android 内存分析命令详解,Java内存模型。Android 内存 OOM 优化和...
我就废话不多说了,大家还是直接看代码吧~ //Uri.parse(file://+result.getImage().getCompressPath())) String path=uri.... Bitmap bitmap= BitmapFactory.decodeFile(path); int height= bitmap.get
软件开发网在此之前给大家介绍过图片加载框架Glide的基本用法介绍,大家可以先参考一下,本篇内容更加深入的分析了Glide获取图片Path、Bitmap用法,以及实现的代码分析。 1. 获取Bitmap: 1)在图片下载缓存好之后...
使用MFC读取24位的位图! 带测试方法,改为灰度图!
若是从内存中读取到的Bitmap为空,则在磁盘缓存中读取。 若是从磁盘中读取到的Bitmap为空,则从起始资源中读取 2.开启工作线程,执行从起始资源中读取bitmap的任务 3.计算合适比例,读取适屏的bitmap 4.检查...
主要为大家详细介绍了Android读取本地或网络图片,并转换为Bitmap,感兴趣的小伙伴们可以参考一下