0

I wrote a TextWatcher for EditText view. In method

@Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            String str = mTxtView.getText().toString();
            if ((str.length() == 2 && len < str.length())) {
                mTxtView.append("/");
            }
        }

nothing happend;

Changing

mTxtView.append("/"); 

with

mTxtView.setText(str+"/"); 

is not suits me, because cursor jumps to 1st position in EditText.

MyFoenix
  • 300
  • 3
  • 11
  • 1
    I'm not entirely sure why append("/") isn't working, however you can workaround your second issue with setText by using editText.setSelection(end_position); as seen here: https://stackoverflow.com/questions/8035107/how-to-set-cursor-position-in-edittext – John Gallagher Aug 11 '16 at 15:11
  • thank you, it works – MyFoenix Aug 11 '16 at 15:21

0 Answers0