Perhaps the actual question is "how to get a byte[] for a given
Bitmap" or vice versa. This is, indeed, Android-specific and not
as obvious as the Base64 part of your question.
However, again, with a couple minutes of Google use, I found
this snippet:
// have Bitmap bitmap from somewhere
ByteArrayOutputStream bos = new ByteArrayOutputStream();
bitmap.compress(CompressFormat.JPEG,100,bos);
byte[] array = bos.toByteArray();
// now have byte[] array to use, e.g., base64 encode
And then on the decompression side,
// have byte[] array from somewhere, e.g., base64 decode
Bitmap bitmap =
BitmapFactory.decodeByteArray(array, 0, array.length);
// now have Bitmap bitmap to use, e.g., to make a drawable
On Jan 28, 11:40 am, saex <[email protected]> wrote:
> Hi
>
> Can someone tell me the code to transforma image (maximum of 200KB)
> into Base64 String???
>
> i need to know how to do it with android, because i have to add the
> functionality to upload images to a remote server in my main app
> putting them into a ROW of the database, as a string.
>
> i am searching in google and in StackOverflow but i can't find easy
> examples that i can afford. And also i find some examples but they are
> not talking about to transform into String... and i need to transform
> into string to upload by JSON to my remote server.
>
> thanks
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en