Wednesday, December 11, 2013

Android coding style and your Android Studio

Android doesn’t have an official coding style, but a damn good place to base your code style on is the official Code Style Guidelines for Contributors.
While this is a very comprehansive guide, you would probably still need to embrace and learn the recommended Java code style in your code.
Android studio integration you mentioned?
Yes! you can have your code style enforced by the Android studio IntelliJ IDE.
  • Download the preference file Google is maintaining for the intelliJ enviorment.
  • Save the file in ~/Library/Preferences/AndroidStudioPreview/codestyles
  • In the Android Studio -> preferences -> Code Style -> select Java and XML and then select the AndroidStyle from the list.
  • Want to have a check on your current source code? run Analyze -> Inspect Code and see the results.


That’s it, have fun and write clean readable code.