InputFilter for edittext

  • Thread starter Thread starter AC Question
  • Start date Start date
A

AC Question

I have applied InputFilter for edittext .The replaceAll("..","$0 ") should replace any two character along with digits ,but if I give only digits it is not working.

What I should get is like while typing in edit text it should append space with it

Eg:
Input : abcd12344a3b
Output: ab cd 12 34 4a 3b

inputFilter = new InputFilter(){
public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {

String s = source.toString()
String rep = s.replaceAll(".." , "$0 ");
return rep;
}
};
EditText.setFilters(new InputFilter[] {inputFilter});
 

Latest posts

Trending Posts

Forum statistics

Threads
956,770
Messages
6,969,947
Members
3,163,616
Latest member
tonga94