byte转化为Bitmap,防止内存溢出
Java代码 ByteArrayInputStreamis=newByteArrayInputStream(byte[]); BitmapFactory.Optionsoptions=newBitmapFactory.Options(); options.inPurgeable=true; options.inInputShareable=true; options.inSampleSize=2; try{ BitmapFactory.Options.class.getField("inNativeAlloc").setBoolean(options,true); }catch(Exceptionex){ ex.printStackTrace(); } BitmapimgBit=(newWeakReference<Bitmap>(BitmapFactory.decodeStream(is,null,options))).get();
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。