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
Contributor
Posts: 12
Registered: ‎10-29-2010
My Device: Not Specified

Re: Pushing a Popup Screen

thanks for the code snippet.......but i dont think you understood me.......i've done exactly the same thing.....but my ques is.....i need to change the value of the variable in this thread i.e. WorkerRunnable as you've put it..... and then do my logic based on the value of the changed variable.....i.e. something like this......how do i do this.......

 

public class WorkerRunnable implements Runnable {
private boolean var;

public WorkerRunnable(){

}

public void run() {
// do some work
// modify the var
this.var = false;
UiApplication.getUiApplication().invokeLater(new Runnable() {
public void run() {
// update UI here, can call screen method
setMyScreenData(-1);
}
});
}

}


// invoking the above thread in my code

WorkerRunnable thr = new WorkerRunnable();
thr.start();
// wait for the WrokerRunnable thread to modify the variable and
// return back
if(thr.var)
//do something

 

New Developer
Posts: 45
Registered: ‎05-25-2010
My Device: 8300
My Carrier: developer

Re: Pushing a Popup Screen

If WorkerRunnable is inner class:

 

public class WorkerRunnable implements Runnable {
        private boolean var;

        public void run() {
            // do some work
            // modify the var
            this.var = false;            
            UiApplication.getUiApplication().invokeLater(new Runnable() {
                public void run() {
			doSomething(var);
                }
            });
        }
        
    }

 In main class:

 

// in main class 
void startRunnnable(){
	WorkerRunnable thr = new WorkerRunnable();
	thr.start();
	// wait for the WrokerRunnable thread to modify the variable and 
	// return back
}
void doSomething(boolean var){
	// process changes here
}

 

 

If WorkerRunnable is top-level class, you can pass caller class instance into WorkerRunnable constructor.

 

Highlighted
Contributor
Posts: 12
Registered: ‎10-29-2010
My Device: Not Specified

Re: Pushing a Popup Screen

yeah......this should work.........didnt use the inner class approach..........thanks a lot Smiley Happy