[android-developers] Re: Problem in encoding image

2010-08-30 Thread pramod.deore
Someone knows how to encode large image in Base64 format. Because I had tried using creating byte array as large as image size but if image it encode image if size of image is upto 800kb, if image is greater than 800kb then it throws runtime exception as OutofMemoryException. So I had decided use

Re: [android-developers] Re: Problem in encoding image

2010-08-30 Thread Kostya Vasilyev
Pramod, Base64 encoding has end-of-data markers. http://en.wikipedia.org/wiki/Base64 Your code encodes each 1024-byte chunk of input image data into its own Base64 string. Each of those has its own end markers. Because of this, the receiving side doesn't see one piece of data encoded with

[android-developers] Re: Problem in encoding image

2010-08-30 Thread pramod.deore
Hi, Kostya I can't use second solutions because they are for API level8 and I am developing this for APilevel4(1.6), But after changing byte array size to 1023 it works perfectly fine, Thanks again Kostya I am working on this from last 8 days and today I got the solution. But still I don't know

Re: [android-developers] Re: Problem in encoding image

2010-08-30 Thread Kostya Vasilyev
It's magic, man. Pure magic. :) Base 64 encoding converts every 3 bytes of input data to 4 bytes of output data. If input data size is not a multiple of 3, output is padded with = characters, which also means end of data. Your original buffer size, 1024, is not a multiple of 3, so each