4

I am making an Android app where I need the user to fill a form. In this form there is a field where the user has to put her/his ID (for example passport) and I would like to know if it is possible to show a keyboard with numbers and text at the same time.

Thanks in advance.

Sergio
  • 725
  • 1
  • 7
  • 20
  • 2
    I think this thread can help you out. https://stackoverflow.com/q/22563088/6577892 try to set: android:inputType="textVisiblePassword" – Subhan Ali Aug 16 '17 at 08:11
  • share your love if it helped you out. :) – Subhan Ali Aug 16 '17 at 08:16
  • Thank you @SubhanAli that's what i was looking for. I only have to add android:inputType="textVisiblePassword" to my EditText. – Sergio Aug 16 '17 at 08:25
  • Possible duplicate of [Show the softkeyboard with only alphanumeric keys?](https://stackoverflow.com/questions/22563088/show-the-softkeyboard-with-only-alphanumeric-keys) – kuzdu Aug 23 '18 at 09:47
  • You are right @kuzdu. That was i wanted to know but already it is solved. – Sergio Oct 09 '18 at 13:10

1 Answers1

0

If you want to set runtime the keyboard's type, use this example:

EditText editText = (EditText) findViewById(R.id.its_your_EditText); 
editText.setInputType(EditorInfo.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD); //TYPE_CLASS_TEXT is the default

And use this example if you want to show the keyboard immediately:

if (editText.requestFocus()) {
    InputMethodManager imm = (InputMethodManager)
    getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT);
}
Abigail La'Fay
  • 749
  • 1
  • 9
  • 18