10-19-2011 07:56 AM
Hi,
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();
theApp.enterEventDispatcher();
}
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){
super();
setTitle("Home Screen");
this.app = app;
nextButton.setChangeListener(this);
add(nextButton);
}
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_SLI
transitionContextPush.setIntAttribute(TransitionCo
transitionContextPush.setIntAttribute(TransitionCo
TransitionContext transitionContextPop = new TransitionContext(TransitionContext.TRANSITION_SLI
transitionContextPop.setIntAttribute(TransitionCon
transitionContextPop.setIntAttribute(TransitionCon
transitionContextPop.setIntAttribute(TransitionCon
engine.setTransition(null, contentScreen, UiEngineInstance.TRIGGER_PUSH, transitionContextPush);
engine.setTransition(contentScreen, null, UiEngineInstance.TRIGGER_POP, transitionContextPop);
app.pushScreen(contentScreen);
}
}
public boolean onClose(){
System.exit(0);
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..
Thanks
10-24-2011 04:22 PM
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/deliverab