Does anybody know how to make a button that deletes one character at a time in an EditText?

I tried the following which is a lame attempt really because I don't know how to do it:

```
public void onClick(View v) {
    // TODO Auto-generated method stub
     switch (v.getId()) {
     case R.id.keypad_0:
         edittext.setText(edittext.getText() + "0");
         break;
     case R.id.keypad_1:
         edittext.setText(edittext.getText() + "1");
         break;
     case R.id.keypad_2:
         edittext.setText(edittext.getText() + "2");
         break;
     case R.id.keypad_3:
         edittext.setText(edittext.getText() + "3");
         break;
     case R.id.keypad_4:
         edittext.setText(edittext.getText() + "4");
         break;
     case R.id.keypad_5:
         edittext.setText(edittext.getText() + "5");
         break;
     case R.id.keypad_6:
         edittext.setText(edittext.getText() + "6");
         break;
     case R.id.keypad_7:
         edittext.setText(edittext.getText() + "7");
         break;
     case R.id.keypad_8:
         edittext.setText(edittext.getText() + "8");
         break;
     case R.id.keypad_9:
         edittext.setText(edittext.getText() + "9");
         break;
     case R.id.keypad_minus:
         edittext.setText(edittext.getText() + "-");
         break;
     case R.id.keypad_del:
         edittext.setText(edittext.getText().length() - 1); //attempt here
         break;

```

If anybody knows please share