如何刷新黑莓OS 6上的popscreen屏幕[上一页]

时间:2011-10-06 17:40:49

标签: blackberry

单击手机上的后退按钮时,我希望刷新上一个屏幕。在BB 6中是否有任何事件刷新popscreen上的前一个屏幕。

2 个答案:

答案 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();
    }
}