Pretty sure you need to override the onKeyDown method

Example:

   @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        switch (keyCode) {
            case KeyEvent.KEYCODE_DEL:
            case KeyEvent.KEYCODE_ENTER:
                 // do some stuff
                return true;
        }

        return super.onKeyDown(keyCode, event);
    }


On Jun 21, 2:55 pm, n179911 <[email protected]> wrote:
> Thanks. I would like to know how to listen for 'Enter Pressed' Key
> event for my view?
>
> On Sun, Jun 21, 2009 at 6:09 AM, 2hill<[email protected]> wrote:
>
> > To get the orange foreground you need to describe the in the xml as
> > focusable. Then add the corresponding focused drawable. when the user
> > runs over it the resources will pull the focused drawable. Hope that
> > helps!
>
> > On Jun 21, 1:25 am, n179911 <[email protected]> wrote:
> >> Hi,
>
> >> I have a view and setOnClickListener to be my code.
> >> My code get invoked when I move my mouse to the view and click.
> >> But how what do i need to register so that it will invoke my code when
> >> I navigate the focus (using up/down keys) and it has orange foreground
> >> and press ENTER key?
>
> >> Thank you.
>
>
--~--~---------~--~----~------------~-------~--~----~
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