views:

249

answers:

2

Hello All,

Is it possible to press keypad programatically so that number for the key pressed shows on the screen? See the screenshort below for more explanation please:

alt text

Details:
Nokia N70
CLDC 1.1
MIDP 2.0

+2  A: 

How you approach it will depend on what you want to achieve.

You can quite easily simulate pressing keys on a Canvas, by calling your Canvas's keyPressed(), keyReleased() and keyRepeated() methods directly.

This could be good for testing a canvas-based game, ensuring a given state is entered when certain keys are pressed on the canvas.

However, this won't allow you to control any form-based interaction, or native prompts. So you can't start the MIDlet, navigate through a LCDUI Form or List, accept a native security prompt, or edit a native TextBox. You'd need to use an emulator and some form of test scripting framework which simulates keypresses, such as Eggplant.

funkybro
@funkybro: could not really get the point to my answer, do you mean it is not possible to type (like when we call) on the screen programmatically?
Sarfraz
A: 

if you want to mimicking the keypressed process, just call the keypressed with the int of key as argument, for example keyPressed(-8);

Or are you trying to display the key number in the screen ?

Ari R. Fikri