@Override
public void onTextChanged(CharSequence s, int start, int before, int count){
if(s.length()>10) {
String edt = s.toString();
String edtResult = edt.substring(Math.max(edt.length() - 10, 0));
edtSearch.setText(edtResult);
}
}
how can i make my edittext to enter only 10 digits num.and also need to remove country code when i paste a phone number which is copied from another resource (need to remove special characters also in that if any )and only i want to show actual 10 digits number on my edittext when i paste and enter?
and in my xml I use
android:digits="0123456789"
for only allowing numbers. If I use
android:setMaxLength="10"
its fine for entering only 10 digits but its not workout when I paste my number which has country code and special chars like [-] in it.