javajava-memobilenokia

Is there a way to programmatically identify the clear button on mobiles by using j2me?


Is there a way to programmatically identify the clear button on mobiles like nokia, sony ericsson, LG, Samsung? Some mobiles having clear ("C") button and some mobiles doesn't have. I want to identify the clear button while my application running time. Is it possible?


Solution

  • @Dogbane's answer is a good starting point...

    another trick is to observe that -8 is a common keyCode to represent Clear. So if you call canvas.getKeyName(-8), and no IllegalArgumentException is thrown, you know that there is a delete key.

    So there's no exact science on this, but a combination of these two approaches should work most of the time.