Home » Android » Android: Set alphanumeric keyboard to show numeric first in EditText

Android: Set alphanumeric keyboard to show numeric first in EditText

Posted by: admin May 14, 2020 Leave a comment

Questions:

I’m implementing an Android App and I need a tip. My EditText, usually, is just numbers, but sometimes numbers and letters.

This is the keyboard that I need as “default”, when the EditText is focused:

numeric keyboard

If I put android:inputType="phone" or android:inputType="number", the result isn’t what I need:

phone layout keyboard

I need numbers and letters. So, is it possible to do? I already tried EVERY inputType. I try to “mix” some inputTypes, like, number | text, but nothing changes.

How to&Answers:

try this

android:inputType="textVisiblePassword"

source

Answer:

If you want a general keyboard you can use this:

android:inputType="text"

This will allow you to use default keyboard with all the special characters, numerics and alphabets one needs.

Looking at the date when this question was asked no doubt it was a hassle to feed the type of keyboard desired. Anyways, if you are still tracking this question. Here’s the answer.

Answer:

<EditText android:inputType="number" ... /> 

Above code must need 1.5 or up version
if its not working also try

EditText num = new EditText(this);
num.setInputType(InputType.TYPE_CLASS_NUMBER);