Is it possible to auto insert characters into an EditText as the user inputs data?

I.e. if the user is entering a long number such as 123456789012, is it possible for this number to appear as he is typing it in the edit text box, but with a dash every 4th character?

So as you type the number above you would see it being entered in the EditText box but would look like this: 1234-5678-9012.

Currently I have an app where you can enter a long number and then press a button and it inserts the dashes for you, but I'm curious if it could be done as you type?

Many thanks for any help.

Edit
Report