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
Highlighted
Developer
Posts: 27
Registered: ‎11-18-2008
My Device: Not Specified
Accepted Solution

UiApplication using PopupScreen

Hello to all,

 

This is my first post on this amazing forum. I have been reading through many great threads with lots of answers to questions I have had in my short-time developing applications for the Blackberry device. Unfortunately I have hit my first stumbling block, which I am sure will be very easy but hey we all start somewhere.

 

The issue I am experiencing is simply creating a PopupScreen in the mainevent thread and wait for input from the user before continuing. In my Swing days I would just use an observable pattern and notify the application of the change yet I seem to be struggling with this concept here. I have attempted to use the pushModalScreen as well as the pushGlobalScreen methods from the UiApplication class but both give me a runtime error .... pushGlobalScreen called by non-event thread.

 

I seem to be missing something probably right in front of me but I would appreciate some help on this. I am simply running this example using the 9000 simulator that is packaged with the JDE v4.6

 

public static void main(String[] args) { MyApp app = new MyApp(); app.enterEventDispatcher(); } MyApp() { final PromptTest prompt = new PromptTest(); invokeLater(new Runnable() { public void run() { pushGlobalScreen(prompt,1,UiApplication.GLOBAL_MODAL); } }); continueProcess(); } public void continueProcess() { // do something with input from PopupScreen } }

 

Thank you.

Developer
Posts: 27
Registered: ‎11-18-2008
My Device: Not Specified

Re: UiApplication using PopupScreen

Well I am a tad bit embarrassed. I was able to solve my own issue. By simply using pushScreen like any other approach and simply migrating some code to process into my fieldChangeListener. I am not sure what I was thinking earlier. I am sorry to have wasted anybody's time on this one.