Professional Documents
Culture Documents
Code Sample: Creating A Screen Transition
Code Sample: Creating A Screen Transition
The following code sample illustrates a slide transition and a fade transition. When the user
opens the application, the first screen appears on the BlackBerry® device and displays a button.
When the user clicks the button, a second screen slides onto the display from the right. The
second screen automatically fades off of the display after two seconds.
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.ui.decor.*;
public ScreenTransitionSample () {
_secondaryScreen = new FullScreen();
_secondaryScreen.setBackground( BackgroundFactory.createSolidBackground(Color.
LIGHTBLUE) );
pushScreen(baseScreen);
Transitions
Description
TRANSITION_FADE
This transition reveals or removes a screen by fading it in or fading it out. This screen transition
creates a fading visual effect by changing the opacity of the screen.
TRANSITION_SLIDE
This transition reveals or removes a screen by sliding it on or sliding it off the display on the
device. You can use attributes to specify that both the new screen and the current screen slide, to
create an effect where both screens appear to move, or that the new screen slides over the current
screen.
TRANSITION_WIPE
This transition reveals or removes a screen by simulating wiping on or wiping off the display on
the device.
TRANSITION_ZOOM
This transition reveals or removes a screen by zooming it in or zooming it out of the display on
the device.
TRANSITION_NONE
No transition occurs.