I want to display an alert to the user that shows a continues progress bar (gauge). My test case is that a http connection is made, some data is downloaded and then displayed to the user. While the download is in progress, the alert should show the user that there is progress.
So far I have found out that I can't use a continues bar, since the user must dismiss it. If the user dismiss it immediately, I can't show the next screen because it hasn't been populated yet with data - it might still be coming from the server. So I decided to use a time-out of 2 seconds, check if a data downloaded flag has been set, and if so let the alert run out, otherwise re-instate it with another 2 seconds times X until the data arrived. (Maybe not the best way to do it..)
My biggest problem is, as you can see with the code below, if I have a wait for flag - data must be available and populated to the list screen, everything just HANGS until I have downloaded the data and populate it. Somehow it seems impossible to tell the alert, please run and entertain the user, until all the data has been downloaded, and THEN you may exit. What seems to happen is that both the alert and list screen must finish before the alert is shown? I am baffled, because I populate the list only after I got data - so basically I told the list to wait for data then go display. Nothing tells the alert to wait too, it should display two separate things! The alert should not be depending on if the list is populated or not..
If you can suggest something that I might try, I will be eternally thankful!
// Insert pre-action code here
//Insert post-action code here