Android examples for File Input Output:Base64
encode base64 string to String
import android.util.Base64; public class Main{ /*from w w w . j av a2s .c o m*/ public static String encode(String s) { s = StringsUtil.trim(s); if ("".equals(s)) return s; try { byte[] encode = Base64.encode(s.getBytes("utf-8"), Base64.DEFAULT); String enc = new String(encode); return enc; } catch (Exception ex) { ex.printStackTrace(); return ""; } } }