I did the following:
Converting Byte Array
public byte[] convertImageViewToByteArray(Bitmap image) {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
image.compress(Bitmap.CompressFormat.JPEG, 100, stream);
return stream.toByteArray()
}
And when I save the image I store it like this:
img3.setImageBitmap(bitmap2);
Bitmap bit3 = Bitmap.createScaledBitmap(bitmap2, 800, 700, false);
byte[] byteArray3 = convertImageViewToByteArray(bit3);
encodedImage = Base64.encodeToString(byteArray3, Base64.DEFAULT);
imagem.setTerceiraFoto(encodedImage);