title: Send message to another window upon Enter key press
body: <p>I want my test data goes to another window after <kbd>Enter</kbd> key press, like a click on the send  button.</p>
  
  <p>I'm using this code:</p>
  
  <pre><code>    text1 = ((TextView) findViewById(R.id.textMsg));
      text1.setOnKeyListener(new OnKeyListener() {
          public boolean onKey(View v, int keyCode, KeyEvent event){
              // If the event is a key-down event on the "enter" button
              if ((event.getAction() == KeyEvent.ACTION_DOWN) &amp;&amp;
                      (keyCode == KeyEvent.KEYCODE_ENTER)) {
                // Perform action on key press
               Toast.makeText(IMSendData.this, text1.getText(), Toast.LENGTH_SHORT).show();
                return true;
              }
  
              return false;
          }  
      });
  </code></pre>
  
  <p>Using this code after I press the <kbd>Enter</kbd> key, its goes on send button, and after second <kbd>Enter</kbd> key press the test data goes to the window.</p>
  
  <p>I want to press <kbd>Enter</kbd> button only once and then the text go to the window.</p>