Java tutorial
//package com.java2s; import java.io.UnsupportedEncodingException; import android.util.Base64; public class Main { public static String base64Encode(String str) { try { str = Base64.encodeToString(str.getBytes("UTF-8"), Base64.DEFAULT); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return str; } }