从 lwuit 表单中调用 destroyApp(true)

发布于 2024-11-25 07:13:14 字数 72 浏览 2 评论 0原文

我想关闭正在运行的 midlet。但当前显示的项目是 lwuit 表单。如何通过单击添加到 lwuit 表单的命令来关闭应用程序。

I want to close a running midlet. But the current item on Display is a lwuit Form. How can I close the app by clicking a Command added to an lwuit Form.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

面犯桃花 2024-12-02 07:13:14

传递 midlet 实例并调用 destroyApp(...) 或使用 notifyDestroyed();

例如,

Sample.java

public class Sample extends MIDlet {

public Sample() {

  // do something
  new Sample1(this); // pass the MIDlet to another class.
 }
}

Sample1.java

public class Sample1 {
public Sample1(final MIDlet midlet) {

  // do something
  Command exitCmd = new Command("Exit") {

            public void actionPerformed(ActionEvent evt) {
                midlat.notifyDestroyed();
            }
        };
 }
}

pass midlet instance and call destroyApp(...) or use notifyDestroyed();.

For example,

Sample.java

public class Sample extends MIDlet {

public Sample() {

  // do something
  new Sample1(this); // pass the MIDlet to another class.
 }
}

Sample1.java

public class Sample1 {
public Sample1(final MIDlet midlet) {

  // do something
  Command exitCmd = new Command("Exit") {

            public void actionPerformed(ActionEvent evt) {
                midlat.notifyDestroyed();
            }
        };
 }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文