【发布时间】:2010-12-02 14:33:50
【问题描述】:
我有一个字节数组,我想将它保存为位图图像。我该怎么办? 看了android.graphics.Bitmap,找到了几种方法,但不知道哪一种适合。 例如 createBitmap(int width, int height, Bitmap.Config config)。我有宽度和高度,但我怎样才能给它我的字节数组?
谢谢
【问题讨论】:
我有一个字节数组,我想将它保存为位图图像。我该怎么办? 看了android.graphics.Bitmap,找到了几种方法,但不知道哪一种适合。 例如 createBitmap(int width, int height, Bitmap.Config config)。我有宽度和高度,但我怎样才能给它我的字节数组?
谢谢
【问题讨论】:
查看BitmapFactory 类中的方法,例如public static Bitmap decodeByteArray(byte[] data, int offset, int length).
偏移量应为 0,长度应为 array.length。
【讨论】: