android图片类型之间相互转换实现代码

2019-12-10 19:57:52刘景俊

4、 byte[] → Bitmap

Java代码如下:

 

 
  1. private Bitmap Bytes2Bimap(byte[] b){   if(b.length!=0){  
  2. return BitmapFactory.decodeByteArray(b, 0, b.length);   }  
  3. else {   return null;  
  4. }   }  
  5. private Bitmap Bytes2Bimap(byte[] b){   if(b.length!=0){  
  6. return BitmapFactory.decodeByteArray(b, 0, b.length);   }  
  7. else {   return null;  
  8. }   } 

以上是我在实践中遇到的一些转换,以后遇到类似的就不用到处找了。

希望本文所述对大家的Android程序设计有所帮助。