android done key event

Solutions on MaxInterview for android done key event by the best coders in the world

showing results for - "android done key event"
Alizee
21 Feb 2018
1import android.view.inputmethod.EditorInfo;
2import android.widget.TextView;
3
4Context context = this;
5
6TextView.OnEditorActionListener editListener = new TextView.OnEditorActionListener() {
7  @Override
8  public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
9    if (actionId == EditorInfo.IME_ACTION_NEXT) {
10      Toast.makeText(context, "next", Toast.LENGTH_SHORT).show();
11    }
12    if (actionId == EditorInfo.IME_ACTION_DONE) {
13      Toast.makeText(context, "done", Toast.LENGTH_SHORT).show();
14    }
15    return false;
16  }
17};
18
19nameEdit.setOnEditorActionListener(editListener);