You can move to a new screen really easily but pushScreen. Create a new .java file named
Question1.java. This will be our new screen. The basic new screen class is below, fill in the class name and constructor to the name of you java file.
/**
* A class extending the MainScreen class, which provides default standard
* behavior for BlackBerry GUI applications.
*/
public final class Question1 extends MainScreen
{
/**
* Creates a new Question1 object
*/
public Question1()
{
// Set the displayed title of the screen
setTitle("Question 1");
}
}
So now, we can add a button, and make the button listener move to the new screen. This code should be in the "MyScreen" (your main screen) java file.
ButtonField btnNext = new ButtonField("Next question (2)", ButtonField.CONSUME_CLICK);
FieldChangeListener customListener = new FieldChangeListener() {
public void fieldChanged(Field field, int context)
{
UiApplication.getUiApplication().pushScreen(new Question1());
}
};
btnNext.setChangeListener(customListener);
this.add(btnNext);