转换Bitmap to Drawable
BitmapDrawable bitmapDrawable = (BitmapDrawable)bitmap;
Drawable drawable = (Drawable)bitmapDrawable;

Bitmap bitmap = new Bitmap (...);
Drawable drawable = new BitmapDrawable(bitmap);

转换Drawable to Bitmap
Drawable d = ImagesList.get(0);
Bitmap bitmap = ((BitmapDrawable)d).getBitmap();

转换Bitmap to byte[]
private byte[] Bitmap2Bytes(Bitmap bm){
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bm.compress(Bitmap.CompressFormat.PNG, 100, baos);
return baos.toByteArray();
}

转换byte[] to Bitmap
private Bitmap Bytes2Bimap(byte[] b){
if(b.length!=0){
return BitmapFactory.decodeByteArray(b, 0, b.length);
}else {
return null;
}
}

更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. 如何使用流星进行API调用并将header传递
  2. JavaScript数据类型的一些注意点(2)
  3. JavaScript初探系列之面向对象
  4. javascript的offset、client、scroll使用
  5. PHP的网站安全问题? (也可能适用于ASP / Ra
  6. 在javascript中调用带有双参数()的函数
  7. 汤姆大叔的深入理解JavaScript读后感一(1
  8. 奈何两字拉成桥、不得不双击两次才能激活
  9. 使用node.js托管一个asp.net或jsp网站。
  10. 用原生js实现数字自相加