Coding convention for Android developer

Hey, If you are new in Android and wondering if there is any Android Coding Standard document available, this post is for you.

Check Android Code Style Guidelines for Contributors. I found the link on stackoverflow, LOL
This link contains a good description of code style rules.

If you are using eclipse IDE and you want to enforce this rules without remembering all of them, then you can use formatting rules provided by Android team: android-formatting.xml.

Download it here

You can import the file to make Eclipse follow the Android style rules. Steps are:

  1. Select Window > Preferences > Java > Code Style.
  2. Use Formatter > Import to import android-formatting.xml.
  3. Organize Imports > Import to import android.importorder.

Figure 1 - Sample of code formatter preview
From now on, after coding a bunch of codes, press Ctrl + Shift + F to automatically format your code.
Code fun.


Post a Comment

Popular posts from this blog

How to wrap a C# library for using in Java, a folk tale about an idiot coding at midnight.