Progress text while retrieving http data

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]

What are using to get the xml data?
Is getXMLData your own function? If so, can you post function please.

I currently use LuaXML. [import]uid: 22878 topic_id: 6921 reply_id: 24330[/import]

I am using LuaXML. The following is from my header on my xml_parser.lua file:
– Code from: http://lua-users.org/wiki/LuaXml

– LUA only XmlParser from Alexander Makeev

I am still looking for a solution to showing progress messages to display in between the http requests. Does anyone have a pattern they can share for this?

Much appreciated. [import]uid: 28616 topic_id: 6921 reply_id: 24410[/import]

I am still playing with this. If anyone has anything to offer as far as feedback or a snippet it would be greatly appreciated. [import]uid: 28616 topic_id: 6921 reply_id: 24690[/import]

You might look at this code sample.

http://developer.anscamobile.com/code/simple-loading-message

Tim [import]uid: 8196 topic_id: 6921 reply_id: 24714[/import]

Most excellent. Thanks for sharing this sample. I was on the way to this but wasn’t quite sure if this was the best approach…

One more question, does this sample work on the droid?

Thanks again. [import]uid: 28616 topic_id: 6921 reply_id: 24727[/import]

No, that sample code uses network.request(), which is currently iOS only. On Android, you’re currently limited to the LuaSocket network library–which is a great library but doesn’t support non-blocking network calls.

Tim [import]uid: 8196 topic_id: 6921 reply_id: 25008[/import]

OK thanks. Do we know when Android will support the non-blocking network calls? [import]uid: 28616 topic_id: 6921 reply_id: 25678[/import]