Java tutorial
//package com.java2s; import android.graphics.Bitmap; import android.util.Base64; import java.io.ByteArrayOutputStream; public class Main { public static String bitmapToBase64(Bitmap bitmap) { try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos); baos.close(); byte[] buffer = baos.toByteArray(); String photo = Base64.encodeToString(buffer, 0, buffer.length, Base64.DEFAULT); return photo; } catch (Exception e) { e.printStackTrace(); } return null; } }