I came across this inconsistency while developing my Secret Box application.
In my application I have an activity that allows user to change the password. The activity has three EditText’s, one to type existing password and two for the new password and the new password repeat.
The new password and the new password repeat is a custom component which sets the EditText to show dots instead of text in the onCreate() method.
The EditText for the existing password is simply set in the layout file with the android:password attribute.
Look at the picture here for the result:
I don’t know if it’s a bug or android:password does something different then PasswordTransformationMethod, but it took me some time and code deleting to figure that out.
Here is the layout file:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<EditText
android:id="@+id/one"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="@string/hello"
/>
<EditText
android:id="@+id/two"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="@string/hello"
android:password="true"
/>
</LinearLayout>
And here is the code:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
EditText txt = (EditText)this.findViewById(R.id.one);
txt.setTransformationMethod(new PasswordTransformationMethod());
}
Notice how EditText one is set in the code and EditText two is set in the layout file.
I hope it helps someone.

Thank you very much for this solution. I may end up posting this as a bug on the android bug tracker if it isn't already there.
It did help someone... me!
just a note that
setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);
also works.