Disable SPACE key in EditText android -


i'd created edittext following.

<edittext         android:id="@+id/et_regis_num"         android:maxlines="1"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:digits="1234567890abcdefghijklmnopqrstuvwxyz"         android:hint="@string/txt_reg_num"         android:inputtype="textcapcharacters"         android:maxlength="10" /> 

in edittext don't want press space key when i'm pressing space key it's working backspace key. means it's deleting 1 character in each twice press.

set inputfilter on edittext. please check below answer it's worked me.

inputfilter filter = new inputfilter() {     public charsequence filter(charsequence source, int start, int end,         spanned dest, int dstart, int dend) {         (int = start; < end; i++) {             if (character.iswhitespace(source.charat(i))) {                 return "";             }         }         return null;     } };  edttxt.setfilters(new inputfilter[] { filter }); 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -