How to type Non-English text in a password EditText with android:inputType="textPassword"

1.4k views Asked by At

I have an EditText with "textPassword" inputType in my app and I tried to set a non-english password but the inputType didn't allow me to choose another language. Maybe my app users prefer to set a persian password.

See The Picture, Please

Any Ideas?

1

There are 1 answers

1
marmor On BEST ANSWER

inputType is considered as a hint to the keyboard app on how to treat a specific text-field, even if some keyboards do allow non-english passwords, you can't count on all keyboard apps to behave like that.

Instead of using the inputType, set the password field to true, this will cause the characters to be hidden from the screen, but will allow you to get any input, you should probably also turn off suggestions (using the inputType field):

<EditText
    android:id="@+id/password"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:inputType="text|textShortMessage|textNoSuggestions"
    android:password="true"/>

UPDATE

You can create a plain EditText with some textual inputType, and just set the characters to appear as dots instead of plain text:

EditText passwordView = (EditText) layout.findViewById(R.id.password);
passwordView.setTransformationMethod(PasswordTransformationMethod.getInstance());