I don't know how to show another page on button click in blackberry using java.
A:
UiApplication.getUiApplication.pushScreen(new Screen());
http://www.blackberry.com/developers/docs/4.5.0api/index.html
Michael B.
2010-09-29 15:29:39
+1
A:
I assume you have a ButtonField added to some kind of Screen. You need to set the FieldChangeListener for the ButtonField:
class YourScreen extends FullScreen {
public YourScreen() {
super();
ButtonField btn = new ButtonField("mybutton");
btn.setChangeListener(new FieldChangeListener() {
public void fieldChanged(Field field, int context) {
synchronized (UiApplication.getApplication().getEventLock()) {
UiApplication.getUiApplication().pushScreen(new FullScreen());
}
}
});
add(btn);
}
}
Also note that you need to either get the event lock before pushing the screen or pass UiApplication.invokeLater a Runnable like so:
UiApplication.getUiApplication().invokeLater(new Runnable() {
public void run() {
UiApplication.getUiApplication().pushScreen(new FullScreen());
}
});
Some basics on UI threading issue on BB here: http://www.thinkingblackberry.com/archives/182
spacemanaki
2010-09-30 17:13:14