Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

iPhone Slide Effect in BlackBerry

0.00/5 (No votes)
18 Feb 2012 1  

Introduction


This article introduces the famous iPhone Master/Details Screens slide effect, to be applied in BlackBerry platform.

Using the Code


Our first screen "FirstScreen.java" (Master) only contains clickable fields (i.e. ButtonFields) that will push the details screen.

In the "SecondScreen.java" (Details), we should register in the constructor of the screen; how the screen will be pushed and pop: and defining the Transition Type, Speed (Duration), and Direction:


Java
//Entering Transition
TransitionContext transition = new TransitionContext(TransitionContext.TRANSITION_SLIDE);
transition.setIntAttribute(TransitionContext.ATTR_DURATION, 500);
transition.setIntAttribute(TransitionContext.ATTR_DIRECTION,TransitionContext.DIRECTION_LEFT);
transition.setIntAttribute(TransitionContext.ATTR_STYLE,TransitionContext.STYLE_OVER);

UiEngineInstance engine = Ui.getUiEngineInstance();
engine.setTransition(null, this, UiEngineInstance.TRIGGER_PUSH,transition);

// Leaving Transition
transition = new TransitionContext(TransitionContext.TRANSITION_SLIDE);
transition.setIntAttribute(TransitionContext.ATTR_DURATION, 500);
transition.setIntAttribute(TransitionContext.ATTR_DIRECTION,TransitionContext.DIRECTION_RIGHT);
transition.setIntAttribute(TransitionContext.ATTR_STYLE,TransitionContext.STYLE_PUSH);
        
engine.setTransition(this, null, UiEngineInstance.TRIGGER_POP,transition);

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here