转换字符串作为Android的位图 [英] Converting String as a Bitmap in android

查看:121
本文介绍了转换字符串作为Android的位图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作在其上的图像从一个设备转移到另一个应用程序 通过蓝牙设备。现在我的问题是,我在转化中位值的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格式。看一看在此链接的更多信息

这篇关于转换字符串作为Android的位图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆