Hi Diane,

Yes, I am using version 2.0, so the long press flag is there. I really
wasn't checking the repeat count and that was the problem! The documentation
about the long press flag really states that it will only be set for the
first repeat event.

Thanks a lot!

On Thu, Dec 10, 2009 at 3:49 PM, Dianne Hackborn <[email protected]>wrote:

> What version of the OS are you working on?  The long press flag was only
> introduced in 2.0, and yes that will definitely have the flag set.  However,
> in all releases of the OS you will receive key repeat events, so if you
> aren't looking at the repeat count and ignoring the event when it is
> non-zero, then you need to take care of that.
>
> On Thu, Dec 10, 2009 at 9:43 AM, Felipe Henriques da Silva <
> [email protected]> wrote:
>
>> 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]<android-developers%[email protected]>
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>>
>
>
>
> --
> Dianne Hackborn
> Android framework engineer
> [email protected]
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  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