Code example for KeyEvent

Methods: getAction

0
    return(super.onOptionsItemSelected(item));
  } 
 
  @Override 
  public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
    if (event == null || event.getAction() == KeyEvent.ACTION_UP) {
      adapter.add(v.getText().toString());
      v.setText("");
 
      InputMethodManager imm=
          (InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
 
      imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
    } 
 
    return(true); 
  } 
 
  private void configureActionItem(Menu menu) {
    EditText add=
        (EditText)menu.findItem(R.id.add).getActionView()