Skip to main content

Restrict the length of Edittext characters

Restrict the length of Edittext characters 




1) Open your sketchware project.Add edittext.
In the logic section, OnActivityCreate 


Add the following code

InputFilter[] editFilters = edittext1.getFilters();
InputFilter[] newFilters = new InputFilter[editFilters.length + 1];
System.arraycopy(editFilters, 0, newFilters, 0, editFilters.length);
newFilters[editFilters.length] = new InputFilter.LengthFilter(10); 
edittext1.setFilters(newFilters);



If you have any doubts , comment below

Comments

Did you like this tutorial ?