Damir
Damir

Reputation: 56229

Is there any options in Android to separate keyboard for integer and for float numbers

I have text field where user need to write some numbers. Is there any options in Android to separate keyboard for integer and for float numbers ( for integer keyboard to have only digits, for float to have digits+ comma and point) ?

Upvotes: 0

Views: 377

Answers (1)

Lars
Lars

Reputation: 4082

myEditText.setKeyListener(DigitsKeyListener.getInstance(false,true));

This will lock the input of the EditText to digits, points and commas. Setting the second boolean to false will allow only integers (no points and/or commas).

Take a look here for the full documentation.

Upvotes: 1

Related Questions