How can i catch a phone keypress with the android SDK? i’ve been looking around for hours without finding anything..
For example:
In some cases, i want to catch the message when a user presses the “hang up” button on the phone, and then discard the message before it reaches the OS.
Is this possible?
You can either handle key events from a view or in general for your whole application:
Handle onKey from a View:
Remember to implement OnKeyListener and to set your listener
YourView.setOnKeyListener(this);The second possibility would be:
You could also ta a look at
onKeyUp.Resource: http://developer.android.com/reference/android/view/View.html
And here you can see a list with all KeyEvents