How to use Actions on Save in Android studio

When working on Android project, you might use a lot of classes and later remove them. As a result, they will be imported into the import section. Additionally, you run the risk of writing improperly formatted code. This will result in codebase seeming messy.

Android Studio offers an option to get rid of all this ugly code.

Meet Actions on Save

Actions on Save provides a way to run multiple operations like Reformat Code, optimize imports, rearrange code etc. before you save the code.

To use Actions on Save,

1. Press Ctrl+Alt+S (or File -> Settings) to open Settings window.

2. Navigate to Tools -> Actions on Save

3. Select all the options you want to perform before saving file.

4. Click OK to save the changes.

action_on_save
Share with your friends

Leave a Reply

Your email address will not be published. Required fields are marked *