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

Reply
Contributor
pxlam15
Posts: 25
Registered: ‎02-04-2013
My Device: Torch
My Carrier: T-Mobile
Accepted Solution

pushScreen not working when calling on another method from another class

Hi all,

Earlier today I was able to get a program running and I was actually relatively happy with it despite it having a lot of bugs.  However, in attempts to remove the bugs and me being foolish and forgetting to back up my previous code it no longer works. Anyway the line of code I used was 

UiApplication.getUiApplication().pushScreen(ScanScreen());

ScanScreen being a method that I created in another class. 

Any help is greatly appreciated thanks!

Please use plain text.
Trusted Contributor
gopi
Posts: 126
Registered: ‎10-15-2010
My Device: Torch 9850
My Carrier: Not specified

Re: pushScreen not working when calling on another method from another class

Did you debugged the code..

Check if any null pointer exceptions occurs or check with display stack for which screen is currently displayed.

 

Please use plain text.
Contributor
Yashil
Posts: 12
Registered: ‎01-19-2013
My Device: curve 8520
My Carrier: vodacom

Re: pushScreen not working when calling on another method from another class

send an instance of the main app to the other class

 

eg OtherClass oc = new OtherClass(this);

 

 

From the other class >>

 

private MyApp _app;

 

public OtherClass(MyApp app){

 

_app = app;

}

 

 

 

now from the metod >>

 

public void method(){

 

_app.invokeLater(new Runnable() {
public void run() {


MyApp.CallMethod();
}
});

 

 

}

Please use plain text.
Contributor
pxlam15
Posts: 25
Registered: ‎02-04-2013
My Device: Torch
My Carrier: T-Mobile

Re: pushScreen not working when calling on another method from another class

Thanks for all the help!  I just made a new button and pushed the event from there.  It is working for now so thanks again for all the help everyone!

Please use plain text.