2

I have set attribute android:inputType in EditText

android:inputType="textWebPassword"` 

but it still shows the password I'm entering. Is there anything else(or instead) that should be done?

 android:layout_width="match_parent" android:layout_height="@dimen/button_height" android:background="@drawable/background_edit" android:ems="10" android:gravity="center" android:hint="@string/new_pass_hint" android:inputType="textWebPassword" android:textColor="@color/edit_text_text_color" android:textColorHint="@color/edt_text_hint_color" android:textSize="@dimen/button_text_size" 

3 Answers 3

3

Try this please

Edttext.setTransformationMethod(PasswordTransformationMethod.getInstance()); 

then this in your layout

android:password="true" 
Sign up to request clarification or add additional context in comments.

2 Comments

It almost fixed it. The first letter is unhidden , and then after typing the second one it is hidden. I will accept your answer anyway, but do you know why it only works after the second letter?
yeah i know that the first code makes it unhidden,but the second code doesn't work unless you add the first one ..setTransformationMethod is programmatic way to set input type.so we set it to PasswordTransformationMethod and then choosed if we want to hide it or not in the layout .Thanks !
0

You must set

android:password="true"

2 Comments

wasn't that deprecated ? Or I'm mistaken? Thanks.
Hmm...seems its deprecated.....but isn't it making the password hidden? As I recently used it and it worked for me.
0

it should be textPassword look at this

<EditText android:id="@+id/edtPassword" android:layout_width="fill_parent" android:layout_height="42dp" android:layout_marginTop="16dp" android:hint="Password" android:inputType="textPassword" android:padding="5dip" android:singleLine="true" android:textColor="#363435" android:textSize="14sp" /> 

2 Comments

There's not much code , I just used a TextWatcher public void afterTextChanged(Editable s) { if(s.length()==0){ edtPass.setBackgroundResource(R.drawable.background_edit); }else { edtPass.setBackgroundResource(R.drawable.text_background); }
I need it textWebPassword because I work with a server that handles all the requests.. but anyway ,nor this or textPassword seem to work for some reason. I've edited original post to show the xml. Thanks.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.