Abb
Abb

Reputation: 3061

how can i set android inputType as textPassword

I have a dialog box that i have created. this is the code for edittext box. but i want the text to be like password textbox. what change can i do?

android:inputType="textPassword"   


final EditText input = new EditText(Setting.this);
                LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
                                        LinearLayout.LayoutParams.MATCH_PARENT,
                                        LinearLayout.LayoutParams.MATCH_PARENT);
                  input.setLayoutParams(lp);

Upvotes: 0

Views: 1394

Answers (2)

Error No.2793985
Error No.2793985

Reputation: 144

May be this

EditText dt = new EditText(this);
dt.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);

Set inputType for an EditText?

Upvotes: 1

Addicted Manish
Addicted Manish

Reputation: 189

input.setInputType(InputType.TYPE_CLASS_TEXT | inputType.TYPE_TEXT_VARIATION_PASSWORD);

Upvotes: 0

Related Questions