/** * 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; }
解决Bitmap读取频发OOM
猜你喜欢
转载自thunder-yan.iteye.com/blog/1662298
今日推荐
周排行