How to use EditTextPreference as a masked Password text field?

Avi Shukron picture Avi Shukron · May 28, 2011 · Viewed 27.1k times · Source

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?

Answer

inazaruk picture inazaruk · May 28, 2011

Here is a short example using xml:

<EditTextPreference
    android:key="@string/key"
    android:title="@string/title"
    android:summary="@string/summary"   
    android:inputType="textPassword" />

Or you can use numberPassword instead of textPassword.