When adding value to a username in an Android app, how do you limit the number of characters used for that username?
CodePudding user response:
private static final int MAX_NUM = 12;
et_name.setFilters(new InputFilter[] { new InputFilter.LengthFilter(MAX_NUM) });
correct the answers.Please help me...
CodePudding user response:
Add android:maxLength in xml
Example Code:
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLength="20"/>
