Android examples for Graphics:Bitmap String
encode Bitmap to base64 String
import java.io.ByteArrayOutputStream; import android.graphics.Bitmap; import android.util.Base64; import android.util.Log; public class Main { private static final String TAG = ""; public static String encodeTobase64(Bitmap image) { Bitmap bitMapImage = image;/* w ww . ja va 2s . c om*/ ByteArrayOutputStream baos = new ByteArrayOutputStream(); bitMapImage.compress(Bitmap.CompressFormat.PNG, 100, baos); byte[] b = baos.toByteArray(); String imageEncoded = Base64.encodeToString(b, Base64.DEFAULT); Log.d(TAG, imageEncoded); return imageEncoded; } }