Before Android Studio was around, many developers (including myself) used Eclipse. In Eclipse you could set actions to be performed On Save. So whenever you saved, you could tell it to format your code, for example.
When I moved to Android Studio I missed this feature. I can understand why it was removed though, since Android Studio constantly saves for you. That way you don’t have to remember to save, it does it for you. You can still save manually if you want, but it’s unnecessary for the most part.
However, I still wanted the ability to format my code and a few other things. In Android Studio you can create custom macros and set them to whatever hotkey you want.
To make a custom macro, simply go
Edit → Macros → Start Macro Recording and then run whatever commands you want. When you’re done, go back to the same menu and hit
Stop Macro Recording and save it as whatever you want. You can see what I run in my formatted save macro below.
Lastly, you’ll probably want to add a shortcut for the macro. So go to Android studio preferences and search for “macro”. You should find a list of macros that you’ve created, and from there you can set the shortcut you want.