CoDe
CoDe

Reputation: 11146

Password:hint showing as an regular text

Just noticed that android:password has been deprecated, and we should be using android:inputType. I did same and set hint text, but instead to show * it is showing regular text

Edit:

android:hint="@string/papssword_hint"
android:inputType="textPassword"

in response it showing papssword_hint instead to convert it into * .

Anyone have suggestion if I am missing anything.

Upvotes: 0

Views: 220

Answers (3)

Arun
Arun

Reputation: 214

Try this:

private TextView txtPhoneNumber;
txtPhoneNumber = (TextView) findViewById(R.id.txtCoursemetsPhoneNumbe
txtPhoneNumber.setHint("Phone number");

Upvotes: 0

Umit Kaya
Umit Kaya

Reputation: 5951

In your .xml, remove inputType:

android:inputType="textPassword"

And in your java code:

EditText password = (EditText) findViewById(R.id.password);
password.setTransformationMethod(new PasswordTransformationMethod());

You can keep the hint in .xml as it is.

Upvotes: 0

Mdlc
Mdlc

Reputation: 7288

A password hint is shown as regular text. It would be "useless" if the hint would be shown as dots instead of text.

Think of scenario where users have multiple passwords and you suggest which one to use in the hint, if it would be shown as * it would be unreadable and unhelpful.

EDIT: If you'd like to show dots, set the following as hint:

android:hint="........"

Upvotes: 1

Related Questions