Kevin Duong
Kevin Duong

Reputation: 658

Code equivalent for android:password="false"

I'd like to ask a simple question, what is the equivalent android code for android:password="false" on the xml layout file. (I googled it but can't find the result:) )

Thank you

Upvotes: 0

Views: 890

Answers (3)

Franci Penov
Franci Penov

Reputation: 75982

The equivalent to android:password="false" is TextView.setTransformation(null). Using it with PasswordTransformationMethod is equivalent of android:password="true"

Upvotes: 3

Jeb
Jeb

Reputation: 599

Documentation for that android:password attribute says to use

setTransformationMethod(TransformationMethod method)

on your TextView. Probably easier to use this:

setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD)

Upvotes: 0

yogsma
yogsma

Reputation: 10586

What do you mean by equivalent android code? If your Editview field is password field, you set android:password="true", if it is not , you don't set anything

Upvotes: 0

Related Questions