DZone
Mobile Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Mobile Zone > Android Studio Formatted Save

Android Studio Formatted Save

This quick tutorial shows you how to set hotkeys to macros in Android Studio to save time on the commands you use frequently.

Pierce Zaifman user avatar by
Pierce Zaifman
·
Jun. 08, 17 · Mobile Zone · Tutorial
Like (1)
Save
Tweet
3.96K Views

Join the DZone community and get the full member experience.

Join For Free

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.

commands

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.

shortcut

Android Studio Android (robot)

Published at DZone with permission of Pierce Zaifman, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • RestTemplate vs. WebClient
  • Common Types Of Network Security Vulnerabilities In 2022
  • How to Translate Value to Executives Using an Outcome-Driven Mindset
  • Kubernetes Service Types Explained In-Detail

Comments

Mobile Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo