Make j2me Alert Dismiss button invisible

吃可爱长大的小学妹 提交于 2019-12-11 13:19:32

问题


Is there any way to not show the default dismiss button when I set Alert to FOREVER?

I was following the following post but it shows me a button with no characters.
http://code-gotcha.blogspot.com/2011/09/dismiss-button-in-nokia-alert.html?showComment=1346738220258#c4876777871081894195

alert.addCommand(new Command("\u200B", Command.OK, 1));
//we dont like to see the DISMISS command, so adding an invisible command

I am using LWUIT forms but have just invoked j2me native alerts to give the app a native look and feel.


回答1:


There's no portable way to do that with MIDP 2 API.

Neither Alert nor Command have any feature that would somehow ensure application developer that particular tricks to command label would make its button invisible.

Even if some hack works at particular device, there's no guarantee that it will work on another. This applies even if you limit self to Nokia devices only - Nokia MIDP implementers are not bound by any specification to adhere to that funny trick with "\u200B" that worked once upon the time with specific device, they "have a right" to change that in any other device and even more, in any newer version firmware for the same device.


As for giving the app a native look and feel if you want this I would strongly recommend you to think twice before using hacks like one you mention because these could very likely have an opposite effect.

Just think of it, users who'd recognize Alert look and feel as familiar one, are most likely used to it from multiple other MIDlets. But thing is, most of these other midlets most likely use non-hacked Alerts that have well defined behavior, when dismiss command appears in particular context.

Now think of how your app would feel in comparison to these typical, regular midlets? Yeah Alerts will look familiar but behavior will differ. In situations when user would expect Alert to have dismiss command, it would not. This is basically a royal road to get users confused and feel bad about unexpected behavior.

Oh that application, the one where routine screen behaves in the wrong way...



来源:https://stackoverflow.com/questions/12257701/make-j2me-alert-dismiss-button-invisible

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!