OK, I have a simple app I have put together that calls 3 web services via HTTP for some XML data, then it parses it and formats the data for a screen. I would like to show a progress indicator while this is happening but I don’t see any results until the entire set of data has been retrieved and displayed.
Here’s what I’d like to do:
Display progress indicators while retrieving the http data
Current implementation:
[lua]-- a local var to handle the message
local message
– something to display a message on the screen
function displayMessage(msgText)
if (message) then message:removeSelf(); message = nil; end
message = display.newText(msgText, 0, 0, native.systemFontBold, 16)
message:setTextColor(255, 255, 255)
message.x = display.contentWidth*0.5
message.y = display.contentHeight*0.5
end
– the main code
displayMessage(‘Phase 1’)
local xml1data = getXMLData(“http://url1”)
displayMessage(‘Phase 2’)
local xml1data = getXMLData(“http://url2”)
displayMessage(‘Phase 3’)
local xml1data = getXMLData(“http://url3”)
displayMessage(’’)
– format and print all data
– wait for a response[/lua]
I have tried various scenarios of using timer.performWithDelay but so far don’t have a clean solution. Any ideas anybody?
Thanks!
[/lua]
[import]uid: 28616 topic_id: 6921 reply_id: 306921[/import]