public boolean onKey(View arg0, int keyCode, KeyEvent event)
if ((event.getAction() == KeyEvent.ACTION_UP) && (keyCode ==
And used the answer from the previous post to hide the keyboard
On Jun 29, 8:17 am, jamesc <jame...@gmail.com> wrote:
> Have a look at View.onKeyUp() or View.onKeyDown() to handle to
> As for the IME, take a look at this recent post:
> On Jun 28, 8:23 am, skooter500 <skooter...@gmail.com> wrote:
> > Hi
> > I have a TextView and a search button on an activity. When I press the
> > enter key, I want to do something and then dismiss the soft keyboard
> > programatically. I have set the TextView to be single line by using:
> > android:singleLine="true", which moves the focus to the next component
> > when you press the enter key
> > 1. How do I trap the enter key? A TextWatcher? An OnKeyListener?
> > 2. How do I dismiss the soft keyboard programatically?
> > Thanks!
> > Bryan
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to firstname.lastname@example.org
To unsubscribe from this group, send email to
For more options, visit this group at