show keyboard with text and numbers for user id in edittext

Viewed 1064

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.

1 Answers

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);
}
Related