sravanthi V
sravanthi V

Reputation: 136

Android: How to implement numeric keypad?

I have an edit text with a background image. When i click on the edit text i should enter numericals. So, I should dispaly a numeric keypad. I did this by android: inputtype = "Phone" method. But iam not getting numeric keypad. Please help me>?

Upvotes: 0

Views: 685

Answers (3)

vk hooda
vk hooda

Reputation: 67

use this..

  editview.setInputType(InputType.TYPE_CLASS_NUMBER);

Best V.k

Upvotes: 0

youssoua
youssoua

Reputation: 802

you have two solutions for that

the 1st one is to do it in the layout like that android:inputType=""... see below lastline:

<EditText android:id="@+id/getLat" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:cursorVisible="true" 
        android:editable="true" 
        android:singleLine="true" 
        android:layout_weight="1" 
        android:inputType="numberDecimal"
      /> 

Upvotes: 0

Rishi
Rishi

Reputation: 987

for this You need to set the EditText's Input type property to number .

android:inputType="number"

Upvotes: 3

Related Questions