I don't know how to send a backspace key event to a EditText
from my own button. Here is what i tried:
Button backSpace=(Button)findViewById(R.id.backSpace_tab);
backSpace.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
text.dispatchKeyEvent(new KeyEvent(KeyEvent.KEYCODE_DEL,KeyEvent.KEYCODE_P));
}
});
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…