views:

95

answers:

2

Hi, I'm having a situation in my current project where I want to Download a wallpaper image from network. I want to download the image in chunks and at the same time display whatever image that has been downloaded in a ImageView. Can someone let me know how to implement this? The type of Image that I would be downloading would be "PNG".

A: 

I think a solution would be to every time you want to display a new part of the image, to create the image from the bytearray using for example this code:

BufferedImage image = ImageIO.read(in);
Roflcoptr
Hi Sebi,Can you please elaborate with a more detailed code snippet?
Amit Chintawar
I suppose when your downloading your images you get an ByteStream? This bytestream has to be converted in a Image. This can be done by the code above. in is the bytestream.
Roflcoptr
Hi Sebi,I couldn't neither find class BufferedImage nor ImageIo. Thats why I asked if you could post some code.
Amit Chintawar
Ah ok its in the javax.imageio package. maybe this isn't included in android. sorry.
Roflcoptr
A: 

Use ImageView with imageView.setImageBitmap downloadthe file with urlConnection and insert its inputStream to BitmapFactory.decodeStram

Adi
Hey Adi,Can you post some code for me?
Amit Chintawar
I'm sorry, I think my answer is not relevant - I only explained how to show external images.. this is a code sample :Url url = new url("http://....");Bitmap bm = BitmapFactory.decodeStram(url.openConnection().getInputStream());imageView.setImageBitmap(bm);
Adi