单击手机上的后退按钮时,我希望刷新上一个屏幕。在BB 6中是否有任何事件刷新popscreen上的前一个屏幕。
答案 0 :(得分:3)
Screen.onExposed()将在上一个屏幕上调用,您可以从那里刷新值。
答案 1 :(得分:2)
class FirstScreen extends MainScreen {
private void refreshOnNextScreenClose() {
// some code to refresh the FirstScreen on NextScreen closure
}
private Runnable onNextScreenCloseCallback = new Runnable() {
refreshOnNextScreenClose();
};
// ..
// somewhere in the code where you create/push NextScreen
NextScreen nextScreen = new NextScreen(onNextScreenCloseCallback);
UiApplication.getUiApplication().pushScreen(nextScreen);
// ..
}
class NextScreen extends MainScreen {
private Runnable onCloseCallback;
public NextScreen(Runnable onCloseCallback) {
super();
this.onCloseCallback = onCloseCallback;
}
public void close() {
super.close();
if (onCloseCallback != null) onCloseCallback.run();
}
}