I\'m trying to decode
and encode
a Bitmap
image. On some devices it runs perfectly while on others it\'s not. I\'m uploading Bas
You are not base64 encoding a Bitmap instance (as you suggest in your post and even in the subject) but a byte array b
in String imageEncoded = Base64.encodeToString(b, Base64.DEFAULT);
. The byte array 'b' contains the bytes of what would be the content of a .jpg file if you would write these bytes to file.
What you have to do is put the contents of the .jpg file which you want to upload directly in a byte array. Then encode that array.
Google for android put file content in byte array
. Code has been posted many times on this site