MIDlet 作为单例

发布于 2024-09-18 11:26:20 字数 192 浏览 3 评论 0原文

MIDlet 类实现为单例是否安全?也就是说,毕竟 Display 类的行为就像每个 midlet 的单例,那么 midlet 本身的行为是否也是单例,这样实现它就不会破坏某些东西?

换句话说,一个应用程序不可能同时运行两个实例,不是吗?我的意思是,AMS 不会允许这样做,不是吗?

谢谢!

Is it safe to implement a MIDlet class as a singleton? That is, after all, the Display class is acting like a singleton for each and every midlet so is the midlet itself a singleton by behaviour so that implementing it as such wouldn't break something?

In other words, it is not possible to have two instances of an app running, is it? I mean, the AMS wouldn't allow it, would it?

Thanks!

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

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

发布评论

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

评论(1

旧瑾黎汐 2024-09-25 11:26:20

通常,Singleton 类具有受保护的构造函数,这会导致问题,因为 AMS 需要 MIDlet 类构造函数是公共的,而不是受保护的或私有的。

Normally Singleton classes have protected constructor, and this will cause a problem because the AMS needs the MIDlet class constructor to be public not protected nor private.

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