Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Coding Style Standards for Android

I would like to know if there is some standard code styling for Android(maybe a book?) (styling XML , Java programming , file naming , etc...)

like image 921
A.Quiroga Avatar asked Sep 25 '11 09:09

A.Quiroga


People also ask

What is coding standards in Java?

In Java, every variable declared has a scope. This means that the visibility and use of the variables must be restricted within the scope only. In case of a local variable, it is visible from the point of its declaration to the end of the method or code block it is declared in.

What is the object of standard coding style?

Purpose of Having Coding Standards: A coding standard gives a uniform appearance to the codes written by different engineers. It improves readability, and maintainability of the code and it reduces complexity also. It helps in code reuse and helps to detect error easily.


2 Answers

There is a good description of code style rules here.

If you want to enforce this rules without remembering all of them, and you are using eclipse then you can use formatting rules provided by Android team: android-formatting.xml. Just import it into eclipse using Preferences->Java->Code Style->Formatter, click Import.

like image 163
inazaruk Avatar answered Sep 20 '22 21:09

inazaruk


There is a ton of information available here: http://source.android.com/source/code-style.html

like image 37
mAndroid Avatar answered Sep 22 '22 21:09

mAndroid