CoDe
CoDe

Reputation: 11156

Enter key event not working on Numeric Input field?

I created two EditText with these two property.

android:digits="0123456789"
android:inputType="numberDecimal"

I use Hardware Keyboard, when I perform Enter Key, focus control not shifting from one view to next view, as it happen normal in EditText case. If I remove "android:digits" property then it work properly, but here it allow to insert decimal key also, that I don't want.

I tried with "android:nextFocusDown" proerty also, but that is also not working in this case.

Any one have idea how can use Enter key event to shift focus.

Upvotes: 2

Views: 1878

Answers (2)

Tarsem Singh
Tarsem Singh

Reputation: 14199

use

Either

android:inputType="number" 

or

android:digits="0123456789"

PS :

best one is android:inputType="number" because it will automatically open the numeric keyboard

where as android:digits="0123456789" this will open simple keyboard

Upvotes: 2

g00dy
g00dy

Reputation: 6788

Add this to the layout:

android:singleLine="true"

You don't need android:inputType="numberDecimal", since you declared only digits in the android:digits="0123456789"

Upvotes: 1

Related Questions