添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
byte[] bitmapArray; bitmapArray = Base64.decode(string, Base64.DEFAULT); bitmap = BitmapFactory.decodeByteArray(bitmapArray, 0, bitmapArray.length); } catch (Exception e) { e.printStackTrace(); return bitmap; 2. Bitmap转换成 String
public String bitmapToString(Bitmap bitmap){
	//将Bitmap转换成字符串
	String string=null;
	ByteArrayOutputStream bStream=new ByteArrayOutputStream();
	bitmap.compress(CompressFormat.PNG,100,bStream);
	byte[]bytes=bStream.toByteArray();
	string=Base64.encodeToString(bytes,Base64.DEFAULT);
	return string;
3. 使用示例 
public void Test(){
	ImageView img = (ImageView) findViewById(R.id.img);
	//首先将图片转换成bitmap,然后将bitmap转换成String
	Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.icon);
	String bitmapString = bitmapToString(bitmap);
	//将String转换成Bitmap之后,通过setImageBitmap将图片显示出来
	img.setImageBitmap(stringToBitmap(bitmapString));
                                    /** * 图片string *  * @param bitmap * @return */ 
    public static String convertIconToString(Bitmap bitmap) { 
        ByteArrayOutputStream baos = new ByteArrayOutputStream();// outputstream
第一种:String 化为bitMap
大致逻辑是先将String 对应到一个 Long类型的数字longMax,内部从0开始,最大值是Long.MAX_VALUE=2^63.再将Long对应到bit链表中,longMax与bit的对应关系保存在bitMap当中。
其中有3个全局变量:
/* recon...
                                    /*** 图片string** @param bitmap*/public static String convertIconToString(Bitmap bitmap) {ByteArrayOutputStream baos = new ByteArrayOutputStream();// outputstreambitmap.compress(CompressFormat.PNG, 10...
byte[] buff;
buff = Bitmap2Bytes(bitmap);
BitmapFactory.Options ontain = new BitmapFactory.Options();
ontain.inSampleSize = 7;//...
                                    问题I am developing an application in which I converted a bitmap to string for some purprose.How can I convert that String  into a Bitmap again?回答1:I converted an Bitmap to String to do some work, now I...
例:String imgString=“R0lGODlhSAAbAPcAAAAAAIAAAACAAICAAAAAgIAAgACAgICAgMDAwP8AAAD\/AP\/\/AAAA\/\/8A\/wD\/\/\/\/\/\/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
	public static String convertIconToString(Bitmap bitmap)
		ByteArrayOutputStream baos = new ByteArrayOutputStream();// outputstream
作者:程序员小冰,CSDN博客:http://blog.csdn.net/qq_21376985 
QQ986945193 博客园主页:http://www.cnblogs.com/mcxiaobing/
今天给大家提供一个常用的工具类。
Android开发之常用必备工具类图片bitmap成字符串stringString字符串转换bitmap图片格式 
下面是代码。当然最下面会分享出来...
要用到来自import android.util.Base64的类
package com.example.administrator.downloadimgdemo.compressutils;/**
 * Created by Administrator on 2017/5/4.
 */import android.graphics.Bitmap;
import android.gra