My code is :
EditText edt
edt.addTextChangedListener(new TextWatcher() {
@Override
public void afterTextChanged(Editable arg0) {
final String number = edt.getText().toString();
int count = arg0.length();
edt.setSelection(count);
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
// TODO Auto-generated method stub
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
final String number = edt.getText().toString();
}
}
I have a dialpad too. When I click a particular number in the dial pad, I need to add that number to the current cursor position. Also, when I press delete, I need to delete the number from the current cursor position.
Dialpad Image

Try the following code
Here is the code to delete selected text from EditText