1

When I searched I got an answer but that didnt help me. Well. Now, in my manifest file I used with that particular activity like this: android:windowSoftInputMode="stateVisible" It works but shows only alpha keyboard! I want actually want numeric keyboard,please.

user3144078
  • 145
  • 2
  • 9

2 Answers2

0

In your focused EditText add this: android:inputType="number"

Mohammad Arman
  • 7,020
  • 2
  • 36
  • 50
0

Is there a particular EditText you want to have focus first for the numeric keyboard?

If so then try this on the relevant EditText:

XML:

<EditText
    android:id="@+id/myEditText"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:ems="10"
    android:inputType="number">
    <requestFocus/>
</EditText>

OR Runtime (onCreate):

EditText editText = new EditText(this);
editText.requestFocus();
editText.setInputType(InputType.TYPE_CLASS_NUMBER);
Mark
  • 9,604
  • 5
  • 36
  • 64
  • In XML inside edittext how to include . It is not accepting. – user3144078 Apr 02 '15 at 02:29
  • I have shown you above? Use one or the other, obviously not both. I have edited the xml version it to show as typical complete example. Also in your java file just addEditText editText = (EditText) findViewById(R.id.myEditText); hope this helps! – Mark Apr 02 '15 at 10:21
  • I used runtime (oncreate). It helped. – user3144078 Apr 04 '15 at 02:16