title: Automatically format phone number in EditText
body: <p>In my app, the user has to enter a phone number in an <code>EditText</code> field using the following format:</p>
  
  <blockquote>
    <p>1(515)555-5555</p>
  </blockquote>
  
  <p>I don't want the user to type "(", ")", or "-" while entering the number; I want these characters to be added automatically.</p>
  
  <p>For example, suppose the user typed <code>1</code> -- the parenthesis after "1" should be added automatically, so that "1(" would be displayed. And I would like to have similar functionality while deleting.</p>
  
  <p>I have tried to set text in the <code>afterTextChanged</code> method of <code>onTextWatcher</code> interface, but it is not working; instead it's causing an error. Any help will be greatly appreciated.</p>