protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.driverinfo); init(); // 初始化 } public void init() { Intent intent = getIntent();
String img = intent.getStringExtra("textImg"); Bitmap bitmap = Bytes2Bimap(img.getBytes()); // 转换图片 ImageView image1 = (ImageView) findViewById(R.id.siji_img_id); image1.setImageBitmap(bitmap); // 设置Bitmap } // 将二进制 转为 Bitmap
private Bitmap Bytes2Bimap(byte[] b) {
if (b.length != 0) {
return BitmapFactory.decodeByteArray(b, 0, b.length);
} else {
return null;
}
}在 xml中 是这么写的<ImageView
android:id="@+id/siji_img_id"
android:maxWidth="100dp"
android:maxHeight="100dp"
/>我已经有 图片的二进制码了, 求教如何显示在 Android程序上求教大神,哪里出错了, 最好能贴出代码, 后天+xml的都要, 谢谢, 在线等,,急!!!!
解决方案 »
- android可以用LINUX的SO库文件吗?
- 命令行使用sqlte3 database is locked的问题
- ApplicationInfo过滤系统程序
- 关于用PC控制android平台?droid VNC server 和screen cast?
- 使用adb shell命令后,想列出data目录下的文件却说没权限,这是为什么?
- 两个路径里面 如果出现重复的exe 是不是以前者为准?
- 求android ADT-22.6.2 的sdk 解压版的
- 关于线性布局里面如何弄一个点击
- 新手学Android,求推荐一本比较合适的书籍
- 华为特殊访问权限
- 请教大家一个关于edittextpreference的问题
- 安卓超诡异InflateException!!!绝对不是手贱打错啊。。
iv.setImageBitmap(bitmap);