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
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…