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: 35
Registered: ‎06-23-2014
My Device: Blackberry Passport
My Carrier: EE

Updating feeds

Hello, I would like it to be able to update and find new feeds.
 
Would this code work?
 
Button{
                maxWidth: 100.0
                translationY: 10.0
                imageSource: "asset:///in_app_icons/ic_reload.png"
                onClicked: {
                    _app.load("feeds.xml")
                }
 
Thanks to anyone that helps.
 
 
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Updating feeds

[ Edited ]

While it would work you need to make sure if you are having multiple feeds that you thread each one, in fact even with a single download you will potenitally stall the UI by doing this.

 

Take a look at threading and signals and slots for how to do what you are trying to do correctly (although this is about openGL it is the same problem of blocking the UI)...

 

http://developer.blackberry.com/native/documentation/cascades/graphics_multimedia/opengl_es/using_th...

 

Although the documentation is slightly wrong here you would not subclass the thread instead use a worker.

 

http://developer.blackberry.com/native/documentation/cascades/dev/signals_slots/

http://developer.blackberry.com/native/documentation/cascades/dev/signals_slots/signals_slots_set_up...

 

 


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

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: Updating feeds

Always takes me a while to find the correct page in the documentation for this one (I should bookmark it Smiley Happy).

 

Anyway at the bottom of this page is an explanation of the preferred way of threading (i.e. using QThread) with some example code...

 

http://developer.blackberry.com/native/documentation/cascades/dev/qt_fundamentals/

 

Before someone else does I will also mention there are lighter ways of writing asynchronous code as well, such as QtConcurrent, which is also mentioned at the bottom of the page at that link. 


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

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 35
Registered: ‎06-23-2014
My Device: Blackberry Passport
My Carrier: EE

Re: Updating feeds

Thanks once again

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

Re: Updating feeds

[ Edited ]

You're welcome

 


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

Developer of stokLocker, Sympatico and Super Sentences.