So we all want to abide by the Android Code Style Guidelines shown in the official Android developer website here.
How do we get started by helping ourselves by abiding by the Java and Android code style rules? Simple. Set it in Android Studio with the instructions below:
1. Copy the file in
https://github.com/android/platform_development/blob/master/ide/intellij/codestyles/AndroidStyle.xml
2. Paste the file into
~/.AndroidStudioPreview/config/codestyles/ (in Ubuntu)
or
~/.AndroidStudioPreview/config/codestyles/ (in Ubuntu)
or
~/Library/Preferences/AndroidStudioPreview/codestyles (in Mac OS X)
3. Go to Settings (or Preferences in Mac OS X) > Code Style > Java, select AndroidStyle, as well as Code Style > XML and select AndroidStyle.
4. Start code inspection and see the results by selecting Analyze > Inspect Code.
You will see the results of inspection on the Inspection pane at the bottom and and you will notice things that you can improve in your Java code such as Code Style Issues, Android, Declaration Redundancy, Probable Bugs and all sorts.
Apart from all this, the autocomplete for member fields will suggest a prefix of 'm' for member fields too. Handy.
Comments
Post a Comment