clear EditText when Enter is pressed
<p>I want to clear an EditText when i click a button or press Enter. It works fine with the button, but when pressing Enter, it clears both the EditText and TextView. </p>

<p>I appreciate any help. Thank you.</p>

<pre><code>public void onClick(View v) {
        textViewEcho.setText(editTextInput.getText().toString());
        editTextInput.setText("");
    }

@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
    if (keyCode == 66) {
        textViewEcho.setText(editTextInput.getText().toString());
        editTextInput.setText("");
    }
    return false;
}
</code></pre>

<p>Update: i found out that onKey is called twice, that's why the TextView's content is cleared, but can't figure out why onKey is called twice, is this a bug in Android?!!!!!</p>

<p>i tried onKeyUp instead, it does work.</p>
