Java tutorial
//package com.java2s; import java.io.UnsupportedEncodingException; import android.util.Base64; public class Main { public static String base64EncodingSenhaLogin(String user, String password) { String param = user + ":" + password; byte[] data = null; try { data = param.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return Base64.encodeToString(data, Base64.DEFAULT).trim(); } }