Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I'm not 100% sure I understand what you want, but if this doesn't work, just add a <em>comment</em> and I'll try to give you a better answer.</p> <p>First, <a href="http://supportforums.blackberry.com/t5/Java-Development/Properly-Push-and-Pop-Global-Screens/ta-p/445097" rel="nofollow">read this on pushing global screens</a></p> <p>and <a href="http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800256/How_To_-_Have_Your_Application_Perform_an_Action_after_a_Global_Alert.html?nodeid=1287205&amp;vernum=0" rel="nofollow">this on performing actions after receiving global alerts</a></p> <p>Your code, if I'm understanding correctly, should be similar to the second link's example.</p> <p>Then, if you implement the <code>DialogClosedListener</code>, like in the second link, you might have something like this:</p> <p><strong>called from the background when you get notified:</strong> </p> <pre class="lang-java prettyprint-override"><code>Dialog myDialog = new Dialog(Dialog.D_OK_CANCEL, "Hello", Dialog.OK, null, 0); myDialog.setDialogClosedListener(new MyListener()); UiApplication.getUiApplication().pushGlobalScreen(myDialog, 1, true); </code></pre> <p><strong>implementation of your dialog listener:</strong></p> <pre class="lang-java prettyprint-override"><code>private class MyListener implements DialogClosedListener { public void dialogClosed(Dialog dialog, int choice) { switch (choice) { case Dialog.OK: // ok clicked UiApplication.getUiApplication().requestForeground(); break; case Dialog.CANCEL: // cancel clicked. or escape pressed break; default: break; } } } </code></pre> <p>And, then in your <code>UiApplication</code> class, you can respond to activation, which will happen if the user selects <strong>Ok</strong> from the <code>Dialog</code>:</p> <pre class="lang-java prettyprint-override"><code>public class MyApp extends UiApplication { private boolean _nextScreenShowing = false; public void activate() { super.activate(); if (!_nextScreenShowing) { pushScreen(new NextScreen()); _nextScreenShowing = true; } } } </code></pre> <p>I show the <code>_nextScreenShowing</code> variable, just to make sure you think about whether pushing the next screen is appropriate. It probably won't be <strong>every</strong> time <code>activate</code> is called. You may need to keep track of that boolean flag by responding to the <code>Application.deactivate()</code> method, or maybe <code>Screen.onExposed()</code> or <code>Screen.onObscured()</code>. All that depends on how your app works.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload