在某些三星机子里使用
Bitmap.createBitmap(bitmap, 0, 0, width, height, matrix, true);
当width=(屏幕宽度)height=屏幕高度时,容易出现oom,可以使用:
http://zhidao.baidu.com/link?url=YzCmJlXyVVmr1GHnXqsLmn9BpwoRfNefDdxNbr_tBzjXQDyL7W962T5eJh8yvGwxNo8YunYvQO6ScdT2c7urjK
http://wenku.baidu.com/view/c7b20053ad02de80d4d840f9.html
BitmapFactory.Options bfOptions=new BitmapFactory.Options(); bfOptions.inDither=false;//使图片不抖动。不是很懂 bfOptions.inPurgeable=true;//使得内存可以被回收 bfOptions.inTempStorage=new byte[12 * 1024]; //临时存储 File file = new File(path);//path:图片的绝对地址 FileInputStream fs=null; try { fs = new FileInputStream(file); } catch (FileNotFoundException e) { e.printStackTrace(); } Bitmap bmp = null; if(fs != null) { try { bmp = BitmapFactory.decodeFileDescriptor(fs.getFD(), null, bfOptions); //这样莫非就让bmp到了临时存储的位置? } catch (IOException e) { e.printStackTrace(); }finally{ if(fs!=null) { try { fs.close(); } catch (IOException e) { e.printStackTrace(); } } } }也可以使用 Bitmap.createBitmap(width, height,Bitmap.Config.RGB_565); 16bit,比reg_8888节约一半的内存容量
今天使用:
org.apache.commons
出现:
This works because even though Android does not have encodeHexString(), it does have encodeHex(). Hope this would help others who run into the same issue.
可以看看:http://stackoverflow.com/questions/9126567/method-not-found-using-digestutils-in-android
解决方案,出错原因:
http://blog.csdn.net/luoqintao/article/details/12019263
根本原因应该是android内部库也有一个org.apache.commons.codecs.*的 jar,导致包名冲突,而优先加载了系统的,而系统的jar包中却没有encodeHexString():