Answers for "android key event"

1

android done key event

import android.view.inputmethod.EditorInfo;
import android.widget.TextView;

Context context = this;

TextView.OnEditorActionListener editListener = new TextView.OnEditorActionListener() {
  @Override
  public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
    if (actionId == EditorInfo.IME_ACTION_NEXT) {
      Toast.makeText(context, "next", Toast.LENGTH_SHORT).show();
    }
    if (actionId == EditorInfo.IME_ACTION_DONE) {
      Toast.makeText(context, "done", Toast.LENGTH_SHORT).show();
    }
    return false;
  }
};

nameEdit.setOnEditorActionListener(editListener);
Posted by: Guest on March-08-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language