Showing a dialog (or screen) from a background thread on BlackBerry

9 Jun

If you need to pop up a dialog or any screen actually from a process that runs in background on BlackBerry, it is fairly easy to do, unfortunately it is (as pretty much everything with BlackBerry development)  easy to figure out how to do.

The following piece of code should do the trick:

		synchronized (Application.getEventLock())
		{
			Ui.getUiEngine().pushGlobalScreen(new CLAScreen(), 1, UiEngine.GLOBAL_QUEUE);
		}

There are also a few things you should be aware of when using this code:

  1. Your backgroud process should implement UiEngine. Easy way is to extend Application.
  2. If you change UiEngine.GLOBAL_QUEUE to UiEngine.GLOBAL_MODAL, the dialog will block your thread until it is closed

Related posts:

  1. Problems running BlackBerry Simulator (fledge) on Windows 7 64 bit
  2. What makes blackberry app a super app – summary of webcast
  3. Android development vs. Blackberry Development
  4. BlackBerry development with Eclipse plugin – fixing corrupted *.jdp file

blog comments powered by Disqus