This article applies to BlackBerry® devices based on Java® technology.
The UiEngineInstance.setTransition method retains a reference to the screen objects passed into it until the application terminates. To ensure screens are properly garbage collected when they are no longer needed, an application must also clear any transitions previously set for them. All transitions set by an application are cleared when the application terminates.
The following code sample demonstrates how a screen transition can be removed when a screen is popped off of the display stack. The Screen.onUiEngineAttached method is overrident to accomplish this.
protected void onUiEngineAttached(boolean attached)
if (attached == false)
//Wrap the call to setTransition in an invoekLater Runnable to //allow the transition to be displayed before it is removed.
public void run()
Ui.getUiEngineInstance().setTransition(_mainScreen2, _mainScreen, UiEngineInstance.TRIGGER_POP, null);