Q:

Display a numeric keypad on activity without an input area

I use the following code to pop up the soft input keyboard in my Activity

InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.getInputMethodList();

imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);

This displays the alphabetic keyboard.
But I want to display the numeric keyboard.
Please note I know that using setInputType() works when used with an Edittext or a TextView but I want to be able to display the keyboard without an input area such as an EditText and simply listen to the key presses on the keyboard.
Can anyone confirm whether this is possible and if so how can it be achieved?

A:

try using the "onKeyDown" methods, I use them for capturing the "back" hard key on phones in my application, an example of the method, using back as the button its listening for, would be
    public boolean onKeyDown(int keyCode, KeyEvent event){
      if((keyCode == KeyEvent.KEY_BACK)){
          back();
      }
         return super.onKeyDown(keyCode,event);
   }

But instead of using KeyEvent.KEY_BACK, try using KeyEvent.KEYCODE_P instead. I'm not possitive if this will work on a soft keyboard, but its worth a shot! good luck

