title: Soft keyboard enter key event handle
body: <p>I want to do some stuff on soft keyboard enter key press. See my code and output below. It executes twice, but I want it to be executed only once. How to fix it?</p>
  
  <pre><code>public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
      txt = (EditText)findViewById(R.id.txt);
      txt.setOnKeyListener(new OnKeyListener() {
  
          @Override
          public boolean onKey(View v, int keyCode, KeyEvent event) {
              if (keyCode == KeyEvent.KEYCODE_ENTER) {
                  Log.e("test","--------- on enter");
                  return false;
              }
              return false;
          }
      });
  }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/py2Lo.png" alt="This is my output for this"></p>