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

Posts: 49
Registered: ‎12-21-2010
My Device: 9000 Bold Device
My Carrier: software developer

Slide Screen Issue



This is my code for sliding screen from left to right using ButtonField.

public class MyApp extends UiApplication
    MyApp app = this;
    public static void main(String[] args)
        MyApp theApp = new MyApp();      

    public MyApp()
        // Push a screen onto the UI stack for rendering.
        pushScreen(new MyScreen(app));

public final class MyScreen extends MainScreen implements FieldChangeListener
    Bitmap bmpResized;
    MyApp app;
    ButtonField nextButton = new ButtonField("Next Screen", ButtonField.CONSUME_CLICK);
    public MyScreen(MyApp app){
        setTitle("Home Screen");
        this.app = app;
    public void fieldChanged(Field field, int context) {
        if (field == nextButton) {
            ContentScreen contentScreen = new ContentScreen(app);
            UiEngineInstance engine = Ui.getUiEngineInstance();
            TransitionContext transitionContextPush = new TransitionContext(TransitionContext.TRANSITION_SLIDE);
            transitionContextPush.setIntAttribute(TransitionContext.ATTR_DURATION, 750);
            transitionContextPush.setIntAttribute(TransitionContext.ATTR_DIRECTION, TransitionContext.DIRECTION_LEFT);
            TransitionContext transitionContextPop = new TransitionContext(TransitionContext.TRANSITION_SLIDE);
            transitionContextPop.setIntAttribute(TransitionContext.ATTR_DURATION, 750);
            transitionContextPop.setIntAttribute(TransitionContext.ATTR_DIRECTION, TransitionContext.DIRECTION_RIGHT);
            transitionContextPop.setIntAttribute(TransitionContext.ATTR_KIND, TransitionContext.KIND_OUT);
            engine.setTransition(null, contentScreen, UiEngineInstance.TRIGGER_PUSH, transitionContextPush);
            engine.setTransition(contentScreen, null, UiEngineInstance.TRIGGER_POP, transitionContextPop);
    public boolean onClose(){
        return true;
Its working fine, but i want slide the screen when we scroll the screen left and right like in Sencha Touch using Carousel Class. is it possible in blackberry. if possible past the sample code..



BlackBerry Development Advisor
Posts: 15,723
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Slide Screen Issue

You could capture a TouchGesture and transtion your screen when the user swipes east or west.  You can read more about touch events here:  http://docs.blackberry.com/en/developers/deliverables/29251/Touch_screen_interaction_models_1222741_...

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker