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

Java Development


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 115
Registered: ‎10-04-2008
My Device: Not Specified
Accepted Solution

Progress Dialog till getting data from http connection ?

Hi,

 

Can someone help me with Progress Dialog till I get the data from Http Connection?

 

I have tried to use Status.show but how will I dismiss that once I have the data. Once I have the data I want to update UI. I think it should be the combination of Thread and UiApplication.getApplication.invokelater, but if someone can guide me in the right direction then it will be of great help.

 

 

 

Regards

Sunil

Regards
Sunil
Developer
Posts: 713
Registered: ‎05-31-2010
My Device: 8520
My Carrier: Movistar

Re: Progress Dialog till getting data from http connection ?

Highlighted
Developer
Posts: 115
Registered: ‎10-04-2008
My Device: Not Specified

Re: Progress Dialog till getting data from http connection ?

[ Edited ]

Hi,

 

Thanks for pointing me to that tutorial. Why is the call like runThis.run() method. start() method of thread should be called and not directly its run() method in PleaseWaitPopUpScreen.

 

Can anyone explain me this? Its a bit confusing so any clarification will be of great help.

 

 

 

Regards
Sunil
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Progress Dialog till getting data from http connection ?

As it says in the referenced article

"applications are not allowed to block the Event Thread".

 

You might find this useful:

 

http://supportforums.blackberry.com/t5/Java-Development/What-is-the-Event-Thread/ta-p/446865

Developer
Posts: 115
Registered: ‎10-04-2008
My Device: Not Specified

Re: Progress Dialog till getting data from http connection ?

Hi,

 

Thanks for pointing to that video, but I understand what is Event Thread.

 

I wanted to know why the meaning of runThis.run() being called in  "PleaseWaitPopupScreen". There's no meaning of implementing Runnable then if we are directly calling its run() method rather than starting thread with start() method. And I think there's no need for implementing Runnable in GetURL since the popup is displayed in another thread and then we call the URL and then popup is removed.

 

Anyways that tutorial helped in solving my problem.

 

Thanks anyways

Regards
Sunil
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Progress Dialog till getting data from http connection ?

What is GetURL?

 

This statement is not correct:

"There's no meaning of implementing Runnable then if we are directly calling its run() method"

 

I recommend that you review the API and looks for things that implement Runnable. 

 

Classes implement Runnable, so that the class can be used in other processing and that processing knows it can execute the supplied classes run method.  In the KB article, the Runnable is passed in to showScreenAndWait() and a separate Thread is created in that processing.  Since the showScreenAndWait() processing creates a separate Thread, it does not need to be passed in a complete Thread, it only needs to know how to run the code, so Runnable is perfect.

 

You could pass in to showScreenAndWait() a Thread, a MenuItem, a TimerTask, or anything else that implements Runnable.

 

The same concept (passing a Runnable) is used with the standard

UiApplication.getUiApplication().invokeAndWait(...);

processing.

 

Note also this statement is not 100% accurate::

"we call the URL"

 

It is the Thread created by showScreenAndWait() that invokes the Runnable.  I think by 'we' in the above you meant your own processing.

 

Hope that clears up the mystery.