Created
May 18, 2014 06:40
-
-
Save jay16/b4738498b7e98e7c90cd to your computer and use it in GitHub Desktop.
android 自带的 base64 编码
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
android 自带的 base64 编码 | |
首先导入包 | |
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); | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment