If you want to detect when a key from soft keyboard is pressed, like Done key, you can use the following code:
mEditText = (EditText)findViewById(R.id.edit);
mEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
//verifies what key is pressed, in our case verifies if the DONE key is pressed
if (actionId == EditorInfo.IME_ACTION_DONE) {
//put your code here
}
return false;
}
});
