user2610135
user2610135

Reputation: 71

how to set editview dynamically

    final EditText pass_edit = new EditText(this);
    pass_edit.setHint("********");
    blur.addView(pass_edit);
    MarginLayoutParams params230 = (MarginLayoutParams) pass_edit.getLayoutParams();
    params230.width = 460; params230.leftMargin = 16; params230.topMargin = 540;
    pass_edit.setLayoutParams(params230);
    Typeface font230=Typeface.SERIF;
    pass_edit.setTypeface(font230);
    pass_edit.setMaxLines(1);
    pass_edit.setImeOptions(EditorInfo.IME_ACTION_NEXT);
    pass_edit.setTransformationMethod(PasswordTransformationMethod.getInstance());
    pass_edit.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);;

i use this code but this will show but show my password. i want to hide my password when i type something in editview.

Upvotes: 0

Views: 34

Answers (1)

matiash
matiash

Reputation: 55370

Just use:

pass_edit.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); 

You need to specify a text class before adding variation flags.

The setTypeface() and setTransformationMethod() calls aren't necessary either.

Upvotes: 1

Related Questions