Java tutorial
//package com.java2s; //License from project: Open Source License import android.util.Base64; import java.io.UnsupportedEncodingException; public class Main { public static String base64Encode(String s) { byte[] data = new byte[0]; try { data = s.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } finally { return Base64.encodeToString(data, Base64.NO_WRAP); } } }