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

Clear Screen Transitions

by Administrator on ‎09-21-2010 10:25 AM - edited on ‎09-22-2010 12:38 PM by BlackBerry Development Advisor (3,316 Views)

Summary

 

This article applies to BlackBerry® devices based on Java® technology.

 


Description

 

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.
UiApplication.getUiApplication().invokeLater(new Runnable() { public void run() { Ui.getUiEngineInstance().setTransition(_mainScreen2, _mainScreen, UiEngineInstance.TRIGGER_POP, null); } }); } }