Thanks letlite,

However I want to be able to display the numeric keypad without having it
input to an EditText so I cant use addTextChangedListener(TextWatcher)

So I want the user to be able to click a button on my UI, the keypad pops up
in numeric form and then I want to be able to listen to what they press on
the keypad.

On Thu, Oct 21, 2010 at 6:28 PM, letlite <[email protected]> wrote:

> Take a look at TextView.addTextChangedListener(TextWatcher)
>
>
> On Oct 21, 9:45 am, Donal Rafferty <[email protected]> wrote:
> > Anybody have any ideas?
> >
> > On Thu, Oct 21, 2010 at 3:21 PM, [email protected] <[email protected]
> >wrote:
> >
> >
> >
> > > I use the following code to listen for the key presses of 0 - 9 from
> > > the soft input keyboard on Android:
> >
> > > ---
> >
> > >        @Override
> > >                        public boolean onKeyDown(int keyCode, KeyEvent
> > > event)  {
> >
> > >                                if(keyCode == KeyEvent.KEYCODE_0)
> > >                                {
> > >                                return super.onKeyDown(keyCode, event);
> > >                                }
> >
> > >                                if(keyCode == KeyEvent.KEYCODE_1)
> > >                                {
> > >                                return super.onKeyDown(keyCode, event);
> > >                                }
> >
> > >                                if(keyCode == KeyEvent.KEYCODE_2)
> > >                                {
> > >                                return super.onKeyDown(keyCode, event);
> > >                                }
> >
> > >                                if(keyCode == KeyEvent.KEYCODE_3)
> > >                                {
> > >                                return super.onKeyDown(keyCode, event);
> > >                                }
> >
> > >                                if(keyCode == KeyEvent.KEYCODE_4)
> > >                                {
> > >                                return super.onKeyDown(keyCode, event);
> > >                                }
> >
> > >                                if(keyCode == KeyEvent.KEYCODE_5)
> > >                                {
> > >                                return super.onKeyDown(keyCode, event);
> > >                                }
> >
> > >                                if(keyCode == KeyEvent.KEYCODE_6)
> > >                                {
> > >                                return super.onKeyDown(keyCode, event);
> > >                                }
> >
> > >                                if(keyCode == KeyEvent.KEYCODE_7)
> > >                                {
> > >                                return super.onKeyDown(keyCode, event);
> > >                                }
> >
> > >                                if(keyCode == KeyEvent.KEYCODE_8)
> > >                                {
> > >                                return super.onKeyDown(keyCode, event);
> > >                                }
> >
> > >                                if(keyCode == KeyEvent.KEYCODE_9)
> > >                                {
> > >                                        Log.d("Keycode", "Got KeyCode
> 9");
> > >                                return super.onKeyDown(keyCode, event);
> > >                                }
> >
> > >                            return true;
> > >                        }
> >
> > > ---
> >
> > > The code works when i display the soft input keyboard in the following
> > > mode:
> >
> > >http://i.imgur.com/Snasz.png
> >
> > > However it does **not** work when I display the soft input keyboard in
> > > the following mode:
> >
> > >  http://i.imgur.com/wf0Kt.png
> >
> > > Why is this?
>
> --
> 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