Вопрос

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.

Это было полезно?

Решение

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...

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top