Latest posts by Sana Modi (see all)
- 80s Happy Birthday Song Download - January 4, 2023
- Traditional Happy Birthday Song Download - December 28, 2022
- The Best VPN For Netflix-2022 - December 17, 2022
Last Updated on November 10, 2022 by Sana Modi
Sometimes you need to handle Enter button while make an application. To handle button in Kotlin Android Studio, you can just copy this kotlin code.
//Handle Enter Button fun myEnter(){ editText.setOnKeyListener(View.OnKeyListener{v, keyCode, event -> if (keyCode == KeyEvent.KEYCODE_ENTER && event.action == KeyEvent.ACTION_UP){ //Start your action Toast.makeText(this, "Hi there ! \n This is a Enter Event Button", Toast.LENGTH_LONG).show() //End action [email protected] true } false }) }
How to use, just call:
myEnter()