Welcome to the Official BlackBerry® Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Contributor
blazaphyrocqua
Posts: 38
Registered: 01-12-2012
My Carrier: Telkomsel
Accepted Solution

Taking response from a yes-no dialog problem

Hi, I have a problem with my dialog box. Long story short, this dialog box will pop-up at a certain time even at the home screen (so it will come out even the application is closed). Here's the code for the dialog box:

 

synchronized(UiApplication.getEventLock()){
UiEngine ui = Ui.getUiEngine();
Dialog dial = new Dialog(Dialog.D_YES_NO, "Open detik.com feeds?",
Dialog.YES,
Bitmap.getPredefinedBitmap(Bitmap.QUESTION),
Manager.VERTICAL_SCROLL);
ui.pushGlobalScreen(dial, 1, UiEngine.GLOBAL_QUEUE);

int response = ((Dialog)dial).getSelectedValue();
if (response == Dialog.YES) {
feeds();
}
}
}

 

Now, I want the application to push a new screen whenever "Yes" is selected. But it doesn't work. Can anyone help me?

Please use plain text.
Developer
simon_hain
Posts: 10,780
Registered: 07-29-2008
My Carrier: O2 Germany

Re: Taking response from a yes-no dialog problem

currently you push the dialog as a queued object, and immediately ask it for it's status. you would need a very fast user for that :smileywink:

push the screen with http://www.blackberry.com/developers/docs/7.1.0api/net/rim/device/api/ui/UiEngine.html#GLOBAL_MODAL to let it block the code, you can get the result when it returns.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.

peter_strange wrote:
"This process should happen traumatically for you in both JDE and Eclipse."
Please use plain text.
Contributor
blazaphyrocqua
Posts: 38
Registered: 01-12-2012
My Carrier: Telkomsel

Re: Taking response from a yes-no dialog problem

Great it works! Thanks Simon! :smileyvery-happy:

Please use plain text.
Contributor
blazaphyrocqua
Posts: 38
Registered: 01-12-2012
My Carrier: Telkomsel

Re: Taking response from a yes-no dialog problem

[ Edited ]

Simon, it works but the dialog box won't come out anymore unless the application is in the foreground...

 

EDIT: It comes out. I was trying doModal() and forgot to remove it. The thing that doesn't come out is the new screen.

Please use plain text.
Developer
simon_hain
Posts: 10,780
Registered: 07-29-2008
My Carrier: O2 Germany

Re: Taking response from a yes-no dialog problem

now that is a different issue, i would suggest to leave this thread as solved and just create a new one.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.

peter_strange wrote:
"This process should happen traumatically for you in both JDE and Eclipse."
Please use plain text.