I ma trying to upload a picture from android to remote server. Everything is working is fine except for large photos. I am getting “memory out of exception” at Base64.encodeBytes() methos. Here is the code.
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 90, stream); //compress to which format you want.
byte [] byte_arr = stream.toByteArray();
String image_str = Base64.encodeBytes(byte_arr);
Can you guys please help me solving this issue ? I have tried to solve this issue by insampling the bitmap before, and it works but it scales down the bitmap and i always want to upload pictures in its original size.
Thanks.
I found the solution regarding uploading exact original size of image to server: