I am using this code: public boolean onKey(View v, int keyCode, KeyEvent event) { msg = (EditText)findViewById(R.id.msg); String message = msg.getText().toString(); if(keyCode == 66) { //It's hitting here twice. } return false; }; Can anyone please tell me why it's hitting twice when I press enter?