Re: [android-developers] onKeyDown Activity method triggered for long clicks.
No you cannot avoid this. A long press will trigger an onKeyDown().
On Thu, Dec 10, 2009 at 8:27 AM, Felipe Henriques da Silva
<hsilva.felipe@gmail.com> wrote:
> Hi,
>
> I have an activity which overrides the onKeyDown method. The documentation
> states the following about onKeyDown:
>
> "Called when a key was pressed down and not handled by any of the views
> inside of the activity."
>
> The problem I have is that this method is being called even when the views
> inside the activity handle it. I have a button implementing a longPress
> listener. What I see on debugger when long clicking on the button with the
> center key is that first onKeyDown from the activity is called then the
> longPress listener from the button gets triggered. Even for Textviews, when
> long clicking on it with the center select, the activity onKeyDown gets
> triggered before the TextView processes the longclick (and shows the Input
> Method context menu).
>
> Does anyone know how to avoid onKeyDown to be triggered on these situations?
> Is the documentation wrong?
> I also considered retrieving the longpress information from the KeyEvent,
> but sometimes it does not arrive with the longPress flag set.
>
> I am using Eclair by the way.
>
> Thanks a lot!
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
--
Romain Guy
Android framework engineer
romainguy@android.com
Note: please don't send private questions to me, as I don't have time
to provide private support. All such questions should be posted on
public forums, where I and others can see and answer them
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home