Android Naming Conventions


The android naming convention is same as java naming convertion.

This Naming conventions are very important thing to follow while develop best android applications.

Four things we need to concentrate while naming in android

1) Wheather it is a noun or verb.
2) Proper use of Characters.
3) No empty spaces are allowed.
4) Avoid using dollar($) symbol.

Package    * Package name should be noun
                   * Package name should be lowercase letters
                   * Package name must be seperated with periods(.dot)


Class        * Class name should be noun
                 * Class name should Initcap.
Example:   AccountHolder, AccountType

Interface    * interface name should be noun.
                   * interface name should Initcap.

Example:    DataHelper, AccountName

Method     * method name should be verb.
                  * starts with lowercase continue with InitCap

Example:    processAccount(), getUserDetail(), diaplayUserDetails()

Variable       *Variable name should be Meaningful and verb.
                     * starts with lowercase continue with InitCap
                     * for local variables like for , while can use lowercase(i,j,k).
                     * Allow dollar($),underscore(_)symbols.underscore is always recommended.

Example:    buttonSubmit, edit_Text_UserName,  _strTotal

Constant           * Constants always in uppercase
                         *  Underscore(_) is permittable


Control Structure

Even for single line statement we need to surround by block {}.This is for best practice.


Poor usage

Good usage


  Put comments before doing anything in program. It make us better understanding when see it again.


Post a Comment

Popular posts from this blog

Share Data Across Application in Android

MD5 Encryption in Android