1

当我创建一个表单和一个 midlet 时遇到问题,我想在用户输入详细信息时通过用户警报,但我遇到了问题,它无法更改屏幕以显示警报

4

1 回答 1

1

使用您问题的第 4 版中提供的代码没有什么比这更容易的了

// ... your AddReview class

    public AddReview(String title, MainFoodie mf) {
        super(title);
        this.mf = mf; // without that you'll get NPE in changeSreen
        // ...
    }

    //...
    private void changeScreen(Alert a, Form f){
        Display.getDisplay(mf).setCurrent(a, f);
    }

    public void commandAction(Command c, Displayable d) {
       if(c.getLabel().equals("Save")){
           // how to show alert here:
           changeScreen(cfmAlert, this)
       }
于 2011-09-17T18:32:02.330 回答