Skip to content
Related Articles
Open in App
Not now

Related Articles

Invoking Search Button in Keyboard While Typing in EditText in Android

Improve Article
Save Article
  • Last Updated : 18 Jul, 2021
Improve Article
Save Article

EditText can sometimes be a way of communicating with applications. Generally, EditTexts are used to fill in information or queries by the user and execute some tasks. Once the text is typed, the information or the query can be passed in the background to make things available or do some operations. But to pass it, there should be some method like if the user stops typing, accept the typed text, or use a button instead to pass the info. 

This is quite similar to a Search Bar. A Search Bar originally is an application of EditText, where users can type something and click the search button on the screen or from the invoked keyboard. By nature, the invoked keyboard does not come with a search button. A developer has to program it in such a way that a search icon appears on the invoked keyboard.

So through this article, we will show you how you should configure your EditText such that you are able to show the Search Icon along with other options available in Android.

Step by Step Implementation

Step 1: Create a New Project

To create a new project in Android Studio please refer to How to Create/Start a New Project in Android Studio

Step 2: Create EditText element in the activity_main.xml (Layout file)

While creating one, remember to put these configuration tags.

  1. android:imeOptions=”actionSearch”
  2. android:inputType=”text”

Check the code below:


<?xml version="1.0" encoding="utf-8"?>
        android:hint="Type something ...."


Now run the application and start typing in the edit text, or simply click on it once. Keyboard gets invoked and you can see the search option at the bottom.

Similarly, we have the following options in Android to replace the existing one:

1. Go


2. Send


3. Done


4. Next


5. Previous


My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!