Categories
不学无术 木有技术

Android BASE64 编码/解码

http://developer.android.com/reference/android/util/Base64.html
http://hi.baidu.com/xxfaxy/item/4c44f6fd4539dd5cc8f33705
首先导入包
import android.util.Base64;
String 变量=android.util.Base64.encodeToString(字符串.getBytes(),Base64.DEFAULT);
也可简写为
String 变量=Base64.encodeToString(字符串.getBytes(),Base64.DEFAULT);
至于解码
byte b[]=android.util.Base64.decode(字符串,Base64.DEFAULT);
String 变量=new String(b);

byte b[]=android.util.Base64.decode(字符串,Base64.DEFAULT);

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.