I have a very simple question:
I have a EditTextPreference
dialog which I want to use for getting the user's password and I want it to be masked.
How can I do that?
I have a very simple question:
I have a EditTextPreference
dialog which I want to use for getting the user's password and I want it to be masked.
How can I do that?
If you want that the password mask persist also after device rotation is suffice to add the following
imeOption
:in the edit text layout
android:imeOptions="flagNoExtractUi"
or programmatically
yourEditText.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
For
androidx
library you should do it programmatically for example you could do it as follows, optionally I am setting the summary with asterisks according to the length of password:In xml you should have something like:
For more info please look at developer.android
Here is a short example using xml:
Or you can use
numberPassword
instead oftextPassword
.android:inputType="numberPassword"
doesn't work for me. Eclipse told me, that no String values are allowed for this attribute. So i used following:This got me a EditTextPreference with a dotted textdisplay and a number keyboard for input.