赞
踩
Drawable drawable =new BitmapDrawable(bmp);
Resources res=getResources();
Bitmap bmp=BitmapFactory.decodeResource(res, R.drawable.sample);
Bitmap bmp=BitmapFactory.decodeResource(res, R.drawable.pic);
private byte[] Bitmap2Bytes(Bitmap bm){
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bm.compress(Bitmap.CompressFormat.PNG, 100, baos);
return baos.toByteArray();
}
private Bitmap Bytes2Bimap(byte[] b){
if(b.length!=0){
return BitmapFactory.decodeByteArray(b, 0, b.length);
}
else {
return null;
}
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。