Problem with HttpUtils

Mark Read

Well-Known Member
Licensed User
Longtime User
Merry Christmas everyone.

I am using a modified "FlickrViewer" program.

The steps are as follows:

1. Parse the URL to find thumbnails and main images - working
2. Place the file and path for thumb and image in a list - working
3. Read the thumb list and load the images into a scrollview - working
4. Click a thumb and load the corresponding main image in a new view - working

So where's the problem?

The list contains the thumbs as they are parsed from the URL, they are correct. The list is completed and then in a loop, the thumbs are loaded. The name is correct but the thumbnail is wrong. They are mixed up. Checking the log I find that the filename is saved to a temp folder (SD card for me) and has the name given by the variable TaskID. Logging this variable produces this output.
B4X:
TaskID: 6
TaskID: 3
TaskID: 5
TaskID: 2
TaskID: 4
TaskID: 8
TaskID: 7
TaskID: 10
TaskID: 11
TaskID: 12
TaskID: 14
TaskID: 9
TaskID: 15
TaskID: 16
TaskID: 17
TaskID: 18
TaskID: 19
TaskID: 20

I have tried to insert a delay between fetching the thumbs (5 secs) but it had no effect. Can anyone help?

Mark
 

mc73

Well-Known Member
Licensed User
Longtime User
Are you httpUtils downloading simultaneously? If so, I would wait until all ids are finished and then load them into the view. BUT, if this takes time, I would choose to perform every single job only after the previous finished.
 
Upvote 0

Mark Read

Well-Known Member
Licensed User
Longtime User
Hello MC73,

After the two lists are complete, I send the thumbnail list to the http-dowmload sub one item at a time with a 5 second delay between sending.

I had a thought, ouch!

The thumbs are added to the scrollview in the JobDone sub. The thumbs are not all the same size (only small differences). This routine will only be called once the thumb is finished. Could this cause the mix up? I have just rechecked. Clicking on the thumb does produce the correct main image??? Just the thumb is wrong but not always.
 
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
You are using a loop probably to get the downloads. I would instead proceed to next download from inside the final download sub, the jobDone.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…