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.

Posts: 237
Registered: ‎07-20-2010
My Device: Not Specified

Re: how many screens can I push in a new thread?

Alas, the button on the main screen approach worked but was not to the liking of the powers that be.  I'll need to pop open a little window like an alert dialog with a button in it telling people that the GPS system is still tring to get their  current location and with a button on it that takes them to the Location screen (where they can choose the method of setting their location (GPS, manually picking a city center or address)) and a second bttton a standard OK button which just dismisses the alert.


So When the app first loads up and gets the http connection and a little data from it, (after the splash screen fades out as that work is done while the splash is displayed) the mainscreen will display, and on top of it I will display my alert if and only if the app is still waiting for the GPS to find the location.


I guess I'll need a background thread running that will monitor for the GPS success and fire up the alert if the GPS is still waiting.   I haven't worked with threads much so I'm not sure what the best way to do that is.  Maybe in the constructor of my app I'll create an inner class alertThread and fire it up like so:


openLocationThread firstloc =  new openLocationThread();


then in the start method I'll have a while loop checking for the GPS connection like so:


public class openLocationThread extends Thread {
private boolean once = true; 
//i want this to only pop up the alert once 
//in the lifetime of the app
public void run(){
while (GPS not finished){
try {
}catch {(InterruptedException e) {
//do nothing
if (once &&


(GPS not finished)


UiApplication.getUiApplication().invokeAndWait(new Runnable(){
public void run(){
if (locscr != null){
once = false;
if (locscr.isDisplayed()){
try{ popScreen(locscr);
}catch(IllegalArgumentException e){}
/* locscr.getMessageField().setText("Your cell site location could not be determined or your phone is improperly connected to the mobile network. Please set your location manually or try again to use GPS/Cell.") ;
//pushScreen(locscr); //locscr.invalidate(); // } } }); } } } }

Will that basic approach work and how will I kil the thread after if does its job?


BTW, why can't I see my cursor on this page ?  it makes it hard to format my post.