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.
05-23-2012 02:45 PM - edited 05-23-2012 02:54 PM
I am working on a code which was developed by my colleague. I think there is some flaw in the design level. I am trying to put a loading screen when navigating from SCREEN A -> SCREEN B.
The reason for using loading screen is, SCREEN B's data is obtained from network, contacting server, parsing with EVENT THREAD, in the fieldchange listener of the button field I am having this code.
public void fieldChangeListener(field a, int context)
//********** Network Connection, SAX Parsing, etc
if(conditon for next screen)
//************Condirion for next screen
SCREEN B or SCREEN C or SCREEN D
The popup screen is missing or sandwiched inbetween A and B, occuring once I move back from B.
when code between POINT A and POINT B is commented out, loading screen is occuring.
Help of any sort is appreciated!!
Solved! Go to Solution.
05-23-2012 04:24 PM
The problem is that the connection is running on the UI thread and blocks your loading screen (the invokeAndWait runs before the pushScreen) and once the connection is over, you are pushing a new screen which hides/dismisses the loading screen.
Another useful link is this:
Hope that helps,
05-23-2012 05:05 PM
Thanks for your reply Erez, I coded with PushScreen(loadingscreen); inside the invoke and wait but what is happening is, Say I am navigating from Screen A to Screen B and l am pushing Loading screen in between, the loading screen is not visible immediately, Screen B is appearing and when I pop Screen B I can see loading screen.
A dialog box without a button can cater my requirement. But is it possible?
05-23-2012 05:29 PM
The fact the you see your loading screen when you pop Screen B is because you do push the loading screen before Screen B and you do not remove it from the stack. So when ever you close Screen B, You will see the screen below it -> your loading screen.
The first thing that you should fix, is to remove the connection from the UI thread and put it on a different thread. Do not use any of the invoke methods as they are running on the UI thread.
Once you will do that, you will encounter the next issue, which is how to dismiss your loading screen and push screen B.
The solution for this is in Peter's tutorial which is in the link I posted above. Read carefully on the Observer design pattern usage.
Regarding your last question about dialog screen without button, you can use popup screen where you don't have to add any buttons.
Hope that helps,
05-24-2012 03:27 AM - edited 05-24-2012 03:28 AM
Thanks for your reply! that was of great help!
The problem is with the design pattern, the loading screen is popped when I am navigating from ScreenA to Screen B, but it is not visible because, the SCREEN A (which is still visible) is still performing network connection action at the end of which I am popping Screen B! So, the loaded popscreen without being noticed is covered By SCREEN B.
There are two possible way to do get what I need,
a) put the network thread in a seperate code
b) use a dialogue box!
Thought the problem is with the design pattern, I would like to mark this thread as closed!