Reputation:
How to show the android numpad on a button click,without using xml. i know the code for showing simple keyboard that is:
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput (InputMethodManager.SHOW_FORCED, 0);
KeyboardMouse.this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
But i want to show only numeric keypad instead. Please help me.
Upvotes: 2
Views: 781
Reputation: 21929
try the following code
EditText ed= (EditText) findViewById(R.id.editeextId);
ed.setInputType(InputType.TYPE_CLASS_NUMBER);
Upvotes: 2