re: only handle key up if i trap key down -- gotcha.

re: handling a key up only if someone else is not doing so
this is what I'm seeing --
in Android 1.5 and 1.6, in my Activity, onKeyUp() is not called if a
textview is selected in my activity (i.e. has the selection state).
In that case, i presume the textview is consuming the key events.
in Android 2.0, in my Activity, onKeyUp() is called **even if** the
textview is selected in my activity.

On Dec 8, 5:33 pm, Dianne Hackborn <[email protected]> wrote:
> I'm not sure exactly what you are saying...  what key are you looking for?
>  In general you should only handle an up key if you have previously received
> the down key.  Please please please do not do any action on up if you have
> not actually received a down.
>
> As far as handling a key up only if someone else is not doing so...  the
> only way to do that is to handle it at the top of the hierarchy (or in
> activity) after the framework has tried to dispatch it to everyone else.
>  I'm not sure that is what you want.  What do you mean "everyone else"?  The
> event dispatching is fairly simply: first the event dispatched to the
> focused view; if that doesn't consume it (that is return true), we walk up
> the hierarchy trying all of the parent views; if none of them do, then it
> goes to the owning Activity or Dialog as appropriate; and if not even those
> consume it, it goes to the default key handler.
>
>
>
> On Tue, Dec 8, 2009 at 5:18 PM, sdphil <[email protected]> wrote:
> > for 1.5 and 1.6
> > in my activity, onKeyUp is called only when the active selection is
> > not in a textview.
>
> > in 2.0, it is called even if the active selection is in a textview.
>
> > how can I differentiate in my ativity onKeyUp() method, whether or not
> > I'm in a text view or not.
>
> > i.e. i would like to handle key up *only* when someone else is not
> > handling it.
>
> > tia.
>
> > --
> > 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]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to