sqlite in background

I'd like to do some relatively heavy data transformation (mostly inserts and updates) but I'd also would like to run an animation in the foreground (to indicate processing).

Unfortunately I can't find a way to create an asynchronous method so that I can run both the sqlite initialization method and the loading animation (using sprite sheets).

Are there any lua/corona features I'm missing or any work around which I haven't thought of?

Thanks

@gryzlaw,

depends on what kind of animation, you can have a sprite animation that keeps looping forever and you can stop it when the SQL returns with some data.

the way would be to load the spritesheet and set the animation to loop forever, then run the SQL command and when it completes, then stop the animation.

cheers,

?:)

@jayantv,

That's what I would have expected, but it didn't work as I thought.

With this code:

1
2
3
4
5
6
7
8
9
10
11
12
13
        local spritext = require "spritext" -- tried also normal sprite animation
        
        local loading = spritext.newAnim("loading.png", 60, 60, 1, 8); 
        loading.x = display.contentWidth / 2
        loading.y = display.contentHeight / 2 - 30
        loading:play()
        localGroup:insert(loading)
        
        local function initialise()
                db.doInit() -- the databse inputs are here
                director:changeScene( "intro")
        end
        timer.performWithDelay(500, initialise, 1)      

Really, no ideas anyone?

views:1354 update:2011/10/5 8:48:05
corona forums © 2003-2011