You are missing a flag to tell EditText that its contents is text:
setInputType(InputType.TYPE_CLASS_TEXT
| InputType.TYPE_TEXT_VARIATION_PASSWORD);
or
setInputType(InputType.TYPE_CLASS_TEXT
| InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
Note the use of TYPE_CLASS_TEXT.
You can also use android:hint in the XML file to specify text to display
when the control is empty:
http://developer.android.com/reference/android/widget/TextView.html#attr_android:hint
Not sure if this works for password fields, but should be easy to check.
-- Kostya
23.11.2010 12:49, umakantpatil пишет:
Hi..
I want to show edittext which will default show faint color text
written as Password. As soon as user focus on it then I want to
convert it from text to password type. I did that but its not
working..
On focus of the password box. I wrote as follows:
EditText tpassword = (EditText) v;
tpassword.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);
tpassword.setTextColor(getResources().getColor(R.color.black));
tpassword.setText();
Here it changes from grey color to black. All text is also cleared.
But it doesn't change to password type. Is this allowed to change
dynamically input type ?
--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com
--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en