Created
March 20, 2021 08:54
-
-
Save abircse/43692bfbf0c74155f944bbc1bd7e922a to your computer and use it in GitHub Desktop.
SearchByKeyboard
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
XML EDITTEXT NEEDS BELOW LINES OF CODE | |
-------------------------------------- | |
android:imeOptions="actionSearch" | |
android:inputType="text" | |
IN ACTIVITY OR FRAGMENT FILE | |
---------------------------- | |
YOUR_EDITTEXT_OBJECT.setOnEditorActionListener(OnEditorActionListener { v, actionId, event -> | |
if (actionId == EditorInfo.IME_ACTION_SEARCH) { | |
// Call your search functionality or method here | |
return@OnEditorActionListener true | |
} | |
false | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment