DZone
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
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
The Latest "Software Integration: The Intersection of APIs, Microservices, and Cloud-Based Systems" Trend Report
Get the report
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Deployment
  4. 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 · Tutorial
Like (1)
Save
Tweet
Share
4.18K 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

  • Stop Using Spring Profiles Per Environment
  • What Are the Benefits of Java Module With Example
  • Monolithic First
  • Building Microservice in Golang

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • 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: