How can i get imput by pressing enter

Hello, and thanks to try to help me, im trying to create an app with android studio, and i want some code to get executed by pressing the enter key, how can i do this?, and if you give me some example i will very glad.
Thank you so much