Label

Thứ Tư, 30 tháng 5, 2012

Field Naming Conventions for Android


  • Non-public, non-static field names start with m.
  • Static field names start with s.
  • Other fields start with a lower case letter.
  • Public static final fields (constants) are ALL_CAPS_WITH_UNDERSCORES.

For example:
public class MyClass {
    public static final int SOME_CONSTANT = 42;
    public int publicField;
    private static MyClass sSingleton;
    int mPackagePrivate;
    private int mPrivate;
    protected int mProtected;
}

http://source.android.com/source/code-style.html

Không có nhận xét nào:

Đăng nhận xét