This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java Micro Edition and the fly likes Detect Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "Detect "dial" button pressed from J2ME program" Watch "Detect "dial" button pressed from J2ME program" New topic
Author

Detect "dial" button pressed from J2ME program

William Asher
Greenhorn

Joined: Jul 23, 2009
Posts: 25
I have an application that successfully dials numbers (using the platformRequest() method). However I have it coded to do that in response to a command. The command is invoked by selecting a menu option (labeled "Dial"). That all works fine.

In addition, I would like my MIDlet to be able to detect that the dial button on the phone was pressed, and then invoke my command as a result of that event. Does anybody know how to detect the physical pressing of the dial button?

All cell phones that I have ever seen seem to have a dial button, so this code should work pretty universally.

Thanks.
Aleksandar Babic
Ranch Hand

Joined: May 30, 2007
Posts: 68
Every button has it's keyCode. You can create event handler that will check which button is pressed.
Only problem can be if key code is specific for every phone.

You can use this code to inspect name and keycode
(this is the link where I found it
http://roseindia.net/j2me/key-codes-midlet.shtml
I just added two lines)

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Detect "dial" button pressed from J2ME program
 
Similar Threads
using same jsp for add/edit and copy
Which JButton is being pressed ? OK or Cancel ?
Javascript Back button
Showing hidden fields on clicking browser's back button
Get selected object name or index