0

Possible Duplicate:
How to open numeric keyboard when click on EditText?

I have an activity with 4 EditText to enter digits. I have already changed their types to numbers in its layout, but chars soft-keyboard shows up. How can I show the numeric keyboard when the activity starts?

Do any one have solution for this? thank you.

Community
  • 1
  • 1
kaushal trivedi
  • 3,405
  • 3
  • 29
  • 47

3 Answers3

4

hey you might added the below line in EditText xml

android:digits="0123456789"

if so remove and add the below line in the xml it works fine

android:inputType="number" 

Check once, as per you question that might be the only problem. if you inputType = number then it never opens alphabets keyboard

TNR
  • 5,839
  • 3
  • 33
  • 62
1

Try this

EditText editText = (EditText)findViewById(R.id.editText1);
editText.setInputType(InputType.TYPE_CLASS_NUMBER);
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput((editText), InputMethodManager.SHOW_IMPLICIT);
silwar
  • 6,470
  • 3
  • 46
  • 66
1

Just inputType = "number" in xml layout file:

<EditText
android:layout_width = "..."
android:layout_heigth = "..."
...
android:inputType = "number"/>
VAdaihiep
  • 521
  • 9
  • 19