Hello I've got a searched EditText
and search Button
. When I type the searched text, I'd like to use ENTER key on softkeyboard instead of search Button
to activate search function.
Thanks for help in advance.
The first is in Settings (tap the three dots when viewing your conversations) > Scroll down to Sending and uncheck Send using Enter. If you're having the smiley issue, keep scrolling down to the bottom and tap Keyboard. In that menu it says Smiley or Enter - make sure yours is set to enter. Hope that helps.
Show activity on this post. You can use newline in Android Jelly Bean while texting too. While typing hold shift key the smiley icon will change to newline icon then move your finger to that newline button, it gives me newline in my text message.
First you need to set the android:imeOptions attribute equal to actionDone for your target EditText as seen below. That will change your 'RETURN' button in your EditText's soft keyboard to a 'DONE' button.
You do it by setting a OnKeyListener
on your EditText
.
Here is a sample from my own code. I have an EditText
named addCourseText
, which will call the function addCourseFromTextBox
when either the enter key or the d-pad is clicked.
addCourseText = (EditText) findViewById(R.id.clEtAddCourse); addCourseText.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_DOWN) { switch (keyCode) { case KeyEvent.KEYCODE_DPAD_CENTER: case KeyEvent.KEYCODE_ENTER: addCourseFromTextBox(); return true; default: break; } } return false; } });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With