Check Mobile App
Read now
Start a Project

Triggering event on click of a particular button from the default soft Keyboard

Save

Many a times we just want that a event should trigger on click of a particular button(like Enter button, Search Button, Done button) from the default soft keyboard of android.

Implementing this is very easy.

All you need to do is search the id of the button on which you want to perform your particular action and simply follow the below steps :

  1.  Get the instance of your EditText from your view.
  2. Add OnEditorActionListener on your EditText.
  3. Implement the logic in the onEditorAction  method of the OnEditorActionListener by first comparing the id of your button.

And it is done, lets have a look at the code for the same , I am sharing the code for Done button of the Soft keyboard. You can change the same as per your need.

CODE :

NOTE : For seeing the id of other buttons, you can open the EditorInfo class of the package   android.view.inputmethod or you can have a look at :  https://developer.android.com/reference/android/view/inputmethod/EditorInfo.html

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

css.php

When I think in getting solutions for my Ecommerce Platform, I think of Webkul. They have been such a blessing in our business. We have spent thousands of dollars in support and modules from them. We love their support team. They work very closely with us, and they always go the extra mile when we need help.

Michael Urresta

Michael Urresta

Talk to Sales

Global

Live Chat
Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home