Android Code Style Guidelines for Contributors

The rules below are not guidelines or recommendations, but strict rules. Contributions to Android generally will not be accepted if they do not adhere to these rules.

Not all existing code follows these rules, but all new code is expected to.

Don’t Ignore Exceptions
Don’t Catch Generic Exception
Don’t Use Finalizers
Fully Qualify Imports
Use Javadoc Standard Comments
Write Short Methods
Define Fields in Standard Places
Limit Variable Scope
Order Import Statements
Use Spaces for Indentation
Follow Field Naming Conventions
Use Standard Brace Style
Limit Line Length
Use Standard Java Annotations
Treat Acronyms as Words
Use TODO Comments
Log Sparingly
Be Consistent
Follow Test Method Naming Conventions


Original source: