imageView.buildDrawingCache(); Bitmap bitmap = profile_image.getDrawingCache(); String encodedImageData = getEncoded64ImageStringFromBitmap(bitmap);
============
public String getEncoded64ImageStringFromBitmap(Bitmap bitmap) { ByteArrayOutputStream stream = new ByteArrayOutputStream(); bitmap.compress(CompressFormat.JPEG, 70, stream); byte[] byteFormat = stream.toByteArray(); // get the base 64 string String imgString = Base64.encodeToString(byteFormat, Base64.NO_WRAP); return imgString; }
(Visited 76 times, 1 visits today)