Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open numeric keyboard when click on EditText?

I read several other posts and using input.setInputType(TYPE_NUMBER_FLAG_DECIMAL); does open the keyboard but its not the numeric keyboard

like image 878
Nipun Gogia Avatar asked Dec 12 '12 12:12

Nipun Gogia


3 Answers

add android:inputType="number" to your edittext in your xml, it will automatically open numeric keyboard when you will click inside edittext.

like image 159
Android Killer Avatar answered Sep 22 '22 01:09

Android Killer


Add android:inputType="number" in xml will automatically open numeric keyboard when click on EditText, but this will allow you to enter characters only numbers, and if you wanna enter other characters, you may try this:

android:inputType="number"
android:digits="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
like image 43
chinben Avatar answered Sep 22 '22 01:09

chinben


You can add the following to your EditText block in XML file:

        android:inputType="phone"
        android:digits="1234567890"

OR

        android:inputType="number"
like image 33
Othman Shawgan Avatar answered Sep 24 '22 01:09

Othman Shawgan