Android Bitmap与String互转(转)
/**
* 图片转成string
*
* @param bitmap
* @return
*/
public static String convertIconToString(Bitmap bitmap)
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();// outputstream
bitmap.compress(CompressFormat.PNG, 100, baos);
byte[] appicon = baos.toByteArray();// 转为byte数组
return Base64.encodeToString(appicon, Base64.DEFAULT); } /**
* string转成bitmap
*
* @param st
*/
public static Bitmap convertStringToIcon(String st)
{
// OutputStream out;
Bitmap bitmap = null;
try
{
// out = new FileOutputStream("/sdcard/aa.jpg");
byte[] bitmapArray;
bitmapArray = Base64.decode(st, Base64.DEFAULT);
bitmap =
BitmapFactory.decodeByteArray(bitmapArray, 0,
bitmapArray.length);
// bitmap.compress(Bitmap.CompressFormat.PNG, 100, out);
return bitmap;
}
catch (Exception e)
{
return null;
}
}
Android Bitmap与String互转(转)的更多相关文章
- Android Bitmap和Drawable互转及使用BitmapFactory解析图片流
一.Bitmap转Drawable Bitmap bmp=xxx; BitmapDrawable bd=new BitmapDrawable(bmp); 因为BtimapDrawable是Drawab ...
- android uri , file , string 互转
1:android Uri 介绍 http://www.cnblogs.com/lingyun1120/archive/2012/04/18/2455212.html 2:File 转成Uri < ...
- [翻译]开发文档:android Bitmap的高效使用
内容概述 本文内容来自开发文档"Traning > Displaying Bitmaps Efficiently",包括大尺寸Bitmap的高效加载,图片的异步加载和数据缓存 ...
- 【转】Drawable /Bitmap、String/InputStream、Bitmap/byte[]
原文:http://wuxiaolong.me/2015/08/10/Drawable-to-Bitmap/ Drawable互转Bitmap Drawable转Bitmap 1234 Resourc ...
- android Bitmap类方法属性 详细说明
(转:http://blog.csdn.net/ymangu666/article/details/37729109) 1. BitMap类public void recycle()——回收位图占用 ...
- 1、Android Bitmap详细介绍
import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io ...
- Android Bitmap详细介绍
package com.testbitmapscale; import java.io.File; import java.io.FileInputStream; import java.io.Fil ...
- Android Bitmap和Canvas学习笔记 [转]
原文:http://www.cnblogs.com/feisky/archive/2010/01/10/1643460.html 位图是我们开发中最常用的资源,毕竟一个漂亮的界面对用户是最有吸引力的. ...
- Android Bitmap详细介绍(转)
转自: Bitmap详细介绍 package com.testbitmapscale; import java.io.File; import java.io.FileInputStream; imp ...
随机推荐
- vultr vs digitalocean vs linode
vultr官方网站:www.vultr.comdigitalocean官方网站:www.digitalocean.comlinode官方网站:www.linode.com 一般来说我们买VPS的时候都 ...
- Geeks 一般二叉树的LCA
不是BST,那么搜索两节点的LCA就复杂点了,由于节点是无序的. 以下是两种方法,都写进一个类里面了. 当然须要反复搜索的时候.能够使用多种方法加速搜索. #include <iostream& ...
- Android支付接入(7):Google In-app-Billing
今天跟大家一起看下Google的in-app Billing V3支付. 如果没有GooglePlay此处附上安装Google Play的一键安装器的链接(需要Root权限):http://ww ...
- 初次使用SQL调优建议工具--SQL Tuning Advisor
在10g中,Oracle推出了自己的SQL优化辅助工具: SQL优化器(SQL Tuning Advisor :STA),它是新的DBMS_SQLTUNE包. 使用STA一定要保证优化器是CBO模式下 ...
- .NET:CLR via C# Shared Assemblies and Strongly Named Assemblies
Two Kinds of Assemblies, Two Kinds of Deployment A strongly named assembly consists of four attribut ...
- 比起 JSON 更方便、更快速、更簡短的 Protobuf 格式
Protocol Buffers 是由 Google 所推出的一格式(後台真硬),你可以把它想像成是 XML 或 JSON 格式,但是更小.更快,而且更簡潔.這能夠幫你節省網路與硬體資源,且你只需要定 ...
- e为无理数的证明
from: http://math.fudan.edu.cn/gdsx/XXYD.HTM
- sql的嵌套查询,把一次查询的结果做为表继续进一步查询;内联视图
Mysql的嵌套表查询 嵌套SELECT语句也叫子查询,一个 SELECT 语句的查询结果能够作为另一个语句的输入值.子查询可以: 出现在Where子句中, 出现在from子句中,作为一个临时表使用, ...
- 认识Mac中的那些符号
今天看到这篇文章,讲了Mac中的各种符号,还是很不错的. http://www.cnblogs.com/jimcheng/articles/4156268.html
- Tengine zabbix 监控
Tengine 配置 在http 段下新增以下配置 req_status_zone server_stat "$host" 3M; server { listen 9008; lo ...