PDA

View Full Version : ImageView problem



Ivan452
02-02-2011, 09:33 AM
Its me again :)

With a problem ofc.

I'm trying to show images in ImageView that I download from internet.
Some images I manage to show and some I don't.
The URL to image is valid, when I type in it in browser it works.

OK emulator maybe every 10-11th picture is not shown. But on phone is like every 5th.
I tried 3 different ways, 2 ways of setting drawable and 1 of bitmap and its the same.

I don't get any exception, The program manages to get the correct URL but it doesn't manage to show every image.
I checked the images size, and they are all similar.

Here is a code, you can skip getImageUrl() and getFirstImageNumber() because those are functions which provide url from HTML page.
http://codeviewer.org/view/code:16d8

Ivan452
02-02-2011, 10:29 AM
OK. I managed to define a problem a bit more.
but its a bit hard to explain.
Lets say pages from which this program read images go 1-2-3-4-5
and lets say that page 3 is unavailable.
Program will display image 1, 2 it will come to three and skip it, then it will display 4 but it will never display 5.
Even thou it gets the right link.... :S

but on emulator its showing it...

Scythe
02-02-2011, 10:40 AM
You should probably be downloading into a local cache on the SD card, and then populating the image views with those images.

Otherwise you're expecting the images to populate from the network, which is a very scary idea.

Ivan452
02-02-2011, 01:27 PM
I tried with some examples of local cache(not sd) but not much luck.
But then again, I dont think I will be able to save those filed, because when i try to load them as Bitmap I just get null. URL is correct, it just wont load them :S