Thanks for the information Romain (maybe this could be updated on the
documentation, or is it already there somewhere?).
Also, shouldn't the KeyEvent always arrive with the longpress flag set in
this case? Or is it normal for it to arrive as a regular click?

Thanks and regards!

On Thu, Dec 10, 2009 at 3:26 PM, Romain Guy <[email protected]> wrote:

> 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
> <[email protected]> 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 [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]<android-developers%[email protected]>
> > For more options, visit this group at
> > http://groups.google.com/group/android-developers?hl=en
>
>
>
> --
> Romain Guy
> Android framework engineer
> [email protected]
>
> 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 [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to