Java tutorial
//package com.java2s; import java.io.ByteArrayOutputStream; import android.graphics.Bitmap; import android.util.Base64; public class Main { public static String encodeBitmap(Bitmap bitmap, Bitmap.CompressFormat compressFormat) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); bitmap.compress(compressFormat, 100, baos); byte[] bytes = baos.toByteArray(); byte[] encodedImage = Base64.encode(bytes, Base64.DEFAULT); return new String(encodedImage); } }