Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Call a server function after page loads

Definately not, sorry.

 

What you are trying to do is show the indicator until you get data back, so start the ActivityIndicator on the page load by all means but the stop should be initiated from when the data has been loaded. There are many signals you can tie in to but when you get that signal then you should stop the ActivityIndicator.

 

In the example given you'll see they use the sql data reply to remove the indicator, depending on your data model you should be able to find a suitable signal as well.

 


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 791
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Re: Call a server function after page loads

I dont get you

What I have done

- timer starts after page completed ( activity indicator loaded)
- i call a function, where i get data from server..when data loaded i remove activity indicator

btw, what I did is exactly whats done in httptest sample app..with networkactivity.qml
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Call a server function after page loads

That's fine then, from your code and the line about 5-6 seconds it looked like you were using the timer to remove the ActivityIndicator.


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Call a server function after page loads

Please explain what the timer is for in your code?


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 791
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Re: Call a server function after page loads

[ Edited ]
yes

I load the page with activity indicator
after page loaded, i start timer 0.0001 seconds to get data from server side.
takes 7 seconds to retreieve data from server..i remove activityindicator then.


the goal of the timer , i want to bring my data after page loaded with activity indicator..

imagine i have submit button on page 1, on click of it..i want to open page 2 and bring my data. not bring my data on click of sumit and wait 7 seconds to open page 2.
Developer
Posts: 791
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Re: Call a server function after page loads

there is also one more important thing. besides i want to bring data after loadin page 2 with acitivyt indicator. not bring my data before opening page 2.

there is this fact " Look like we can't access to qml object when the page is creating( even we call it in onCreationCompleted). "

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Call a server function after page loads

You should be loading the data asynchronously, using either one of the workers or threading...

 

http://developer.blackberry.com/native/reference/cascades/bb__data__asyncdataaccess.html

 

You shouldn't need a timer at all just run the thread when the page is first loaded.


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.