@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public static byte[] convertBitmapToBytes(Bitmap bitmap)
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH)
{
ByteBuffer buffer = ByteBuffer.allocate(bitmap.getByteCount());
bitmap.copyPixelsToBuffer(buffer);
return buffer.array();
}
else
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos);
byte[] data = baos.toByteArray();
return data;
}
}
MIP_BitmapUtils.java 文件源码
java
阅读 33
收藏 0
点赞 0
评论 0
项目:amap
作者:
评论列表
文章目录