Improved solution from so answer, with copy-paste support
Credit card input filter example:
yourEditText.setFilters(new InputFilter[]{
new InputFilter.LengthFilter(23),
new SpacesInputFilter(23, new int[]{4, 9, 14, 19}, ' '),
});
Really liking your class, very handy. One improvement though would be to NOT allow the space character in positions other than those specified in the spaces Array.