转换字符串作为Android的位图位图、字符串、Android

2023-09-05 04:35:08 作者:一廂情願而已

我的工作在其上的图像从一个设备转移到另一个应用程序 通过蓝牙设备。现在我的问题是,我在转化中位值的byte []通过蓝牙。 现在再怎么解决它为位图...

I am working on an application which transfers the image from one device to another device via bluetooth. Now my problem is, I am transfering the bitmap value as byte[] through bluetooth. Now how to resolve it again into bitmap...

在此先感谢...

推荐答案

使用的BitmapFactory.de codeByteArray()方法。

Use the BitmapFactory.decodeByteArray() method.

byte[] byteArray; // the data
int offset = 0; // offset into array
int length = 1024; // length of array
Bitmap bm = BitmapFactory.decodeByteArray(byteArray, offset, length);

我觉得对于这个字符串应该是Base64格式。看一看在此链接的更多信息