put a character on edittext while typing

view story

http://stackoverflow.com – I have an EditText, and I want to use it for input date, I want to make it so when user insert date, my app will automatically add '-' on EditText, so user only need to insert number, ex; user type: 21 -> device automatically 21- user type: 01 -> device automatically 21-01- user type: 2013 -> device automatically 21-01-2013 I tried this; edtTxt1.addTextChangedListener(new TextWatcher() { public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { // TODO Auto-generate (HowTos)