Farid Farhat
Farid Farhat

Reputation: 2310

Pressing the green key in blackberry

I want to know when the user presses the green button in the device to initiate a phonecall from the app directly. What event is fired when the green key is pressed?

Thanks

Upvotes: 0

Views: 236

Answers (2)

nurnachman
nurnachman

Reputation: 4565

You need to implement KeyListener

import net.rim.device.api.system.KeyListener;

override the function

public boolean keyDown(int keycode, int time)

and inside it catch the event of pressing buttons.

How do you check which button was pressed?

if (Keypad.KEY_SEND == Keypad.key(keycode)) {//your code}

find the API DOC here : http://www.blackberry.com/developers/docs/4.0.2api/net/rim/device/api/ui/Keypad.html

Upvotes: 3

Dan Harris
Dan Harris

Reputation: 1386

I found the answer to be something similar to this.

Override keyDown:

public boolean keyDown(int keycode, int time)
{
   if (keycode == Keypad.SEND)
  {
    //handle your event
    return true;
  }
  return super.keyDown(keycode, time);
}

Upvotes: 2

Related Questions