1     public byte[] getBitmapByte(Bitmap bitmap){
 2         ByteArrayOutputStream out = new ByteArrayOutputStream();
 3         bitmap.compress(Bitmap.CompressFormat.JPEG, 100, out);
 4         try {
 5             out.flush();
 6             out.close();
 7         } catch (IOException e) {
 8             e.printStackTrace();
 9         }
10         return out.toByteArray();
11     }
12     
13     
14     public Bitmap getBitmapFromByte(byte[] temp){
15         if(temp != null){
16             Bitmap bitmap = BitmapFactory.decodeByteArray(temp, 0, temp.length);
17             return bitmap;
18         }else{
19             return null;
20         }
21     }

 

相关文章:

  • 2021-05-28
  • 2022-12-23
  • 2021-11-09
  • 2021-12-02
猜你喜欢
  • 2021-12-17
  • 2022-12-23
  • 2022-02-20
  • 2022-12-23
  • 2021-05-23
  • 2022-12-23
相关资源
相似解决方案