07-14-2012 12:47 AM - edited 07-14-2012 12:49 AM
Ok, so my goal is to :
1. Read some bytes from a httpconnection where the url is located
2. Use that information to construct an empty bitmap with the width and height
3. Read all the bytes from httpconnection and populate the empty bitmap with that information
The question I have is that let's say the external image I'm reading from is a png. What function of the Bitmap class can I use to populate the empty bitmap with the full byte array that I read? Will setRGB565 work in this case? Or is it just not possible?
07-14-2012 04:04 PM
I just re-read your message and saw that I understood something else completely...
Anyway, can you please give some more details on your requirements?
In particular, why do you need to create an empty bitmap and only after to populate it...
07-14-2012 11:02 PM - edited 07-14-2012 11:04 PM
1.Create empty bitmap with dimensions of not completely downloaded image
2. Add bitmap to UI
3. Add data to bitmap
Using this technique I can reduce layout interruptions/lag caused by having to scale the image to the correct size. I can then then just call invalidate instead of updateLayout.
07-14-2012 11:18 PM
I've attached a class that does the first part. You will need to modify it to store all the read bytes into the bytearrayoutputstream for every function. I only did it for the png file. You must use those bytes and append to the beginning of the rest of the stream you read in for the stream to be read correctly.