Code example for Spanned

Methods: subSequence

0
            EditText et = (EditText) view;
                et.setFilters(new InputFilter[]{
                        new InputFilter() {
                            public CharSequence filter(CharSequence src, int start,
                                                       int end, Spanned dst, int dstart, int dend) {
                                return src.length() < 1 ? dst.subSequence(dstart, dend) : "";
                            } 
                        } 
                }); 
            if (b) {
                Log.d(TAG, "hasFocus true called " + et.getText());
                et.setText("focused");
                et.setSelection(et.length());
 
            } else { 
 
                Log.d(TAG, "hasFocus false called " + et.getText());
                et.setText("unfocused");
                //TODO Save to DB 
            } 
        }