[mono-android] [BUG?] OnKeyLongPress doesn't work

Jonathan Pryor jpryor at novell.com
Sun Mar 20 22:37:37 EDT 2011


On Mar 20, 2011, at 7:00 AM, Amir Waldman wrote:
> I've overridden OnKeyLongPress in the Activity but it doesn't seem to do anything, the debugger never stops there.

As a guess:

	http://developer.android.com/reference/android/view/KeyEvent.Callback.html#onKeyLongPress(int, android.view.KeyEvent)

implies that you need to _also_ override Activity.OnKeyDown()[0] _and_ call KeyEvent.StartTracking()[1].
 
> Is it possible to catch the Back button's long press?

The Activity.OnKeyDown() docs [1] suggest that Activity.OnKeyDown() is responsible for the Back button behavior in the first place, which does suggest that you _can_ catch it, if you override Activity.OnKeyDown().

 - Jon

[0] http://docs.mono-android.net/index.aspx?link=M%3aAndroid.App.Activity.OnKeyDown(Android.Views.Keycode%2cAndroid.Views.KeyEvent)

[1] http://docs.mono-android.net/index.aspx?link=T%3aAndroid.Views.KeyEvent



More information about the Monodroid mailing list