native.setActivityIndicator

8 replies [Last post]
shuri
User offline. Last seen 1 year 50 weeks ago. Offline
Joined: 29 Jul 2009

Hi,
the setActivityIndicator don't works fine... It blocks the screen but don't show the activiti indicator.
It's a problem only for me?

Thanks in advance
Alessandro

Replies

carlos m. icaza's picture
carlos m. icaza
User offline. Last seen 8 hours 46 min ago. Offline
Ansca Staff
Joined: 22 Jun 2009

can you provide a code snippet that is giving you trouble?

Carlos

shuri
User offline. Last seen 1 year 50 weeks ago. Offline
Joined: 29 Jul 2009

It happens only on the device, in the simulator the activity indicator show correctly.
Here the code:

...

function loadData(page)
native.setActivityIndicator( true )
b, c, h = http.request( "http://www.xxx.net/" .. page .. ".txt" )
native.setActivityIndicator( false )
...
end

...

Do you need all the code?

shuri
User offline. Last seen 1 year 50 weeks ago. Offline
Joined: 29 Jul 2009

My last trial day :)
This is very important for my application, there is a solution?

Thanks
Alessandro

evank
User offline. Last seen 1 year 4 weeks ago. Offline
Joined: 16 Sep 2009

I believe this does work, but if so we need to document the workaround. Logged as bug #128 in the meantime.

carlos m. icaza's picture
carlos m. icaza
User offline. Last seen 8 hours 46 min ago. Offline
Ansca Staff
Joined: 22 Jun 2009

Alessandro

still having issues?

Did your trial expired?

reach me at info @ anscamobile.com

c

petrsvar
User offline. Last seen 4 weeks 5 days ago. Offline
Joined: 24 Feb 2010

I have similar code, but opposite problem: Indicator shows, but screen is not blocked

Corona 2.0 Beta 4, iPhone 3GS, Software version 3.1.3

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
local rightPress = function( event )
         native.setActivityIndicator( true )
end
 
 
local rightRelease = function( event )
 
downloadingURL = server..path.."buttons.php?user_name="..userName
 
        table1[1] = nil -- delete 1st position of table, otherwise every new stuff goes after it!
        
        http.request{
           url = downloadingURL,
           sink = ltn12.sink.table(table1),
           }
        native.setActivityIndicator( false )    
end

Matthew Pringle
User offline. Last seen 3 weeks 2 days ago. Offline
Joined: 23 Feb 2010

I had a similar problem and I think it is because you are doing it in 1 loop

if you set and remove the activity indicator in the same loop you will never see it as both those commands are processed before the screen is updated

I setup 2 functions in the end and it works as expected

function 1
- show activity indicator
- do http request

function 2
- remove activity indicator

the http request needs to call function 2 when it has completed

sorry can be more helpful as away from computer but the above works (you just need to code it)

OderWat
User offline. Last seen 28 weeks 16 hours ago. Offline
Joined: 4 Jun 2010

Makes sense @Matthew ...

Corona does never updates the screen while code is running.

This applies to the synchronous http request as well!

This also means that you will never get a "enterFrame" event interrupt while your code runs. Which means you do not need to lock states for changes in the stage as long as they are done in the same "event".

I just was thinking about stuff like that because of my store / restore of the gamestate which besides of other stuffs lets the play-field uninitialized for quiet some time. I do not need to stop the "enterFrame" events for this time as I had to do for other frameworks.

Viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.