Android naming Convention (custom)

Source: Internet
Author: User

This specification reference from the Android source code, and to improve, for personal use only, if you think there is merit, you can refer to the next, there are good rules, and then add

General Specification:

The class name should be clear, can reflect the role of this class, it is best to achieve the effect of the name and understanding

  method name to use the verb phrase eg:public boolean movetasktoback (Boolean nonroot);

The constructor uses the Pascal naming convention, also called the Big hump rule, the first letter capitalized

Common methods and member variables are small hump rules (Camel rules), first letter lowercase

The local variables of the common method are underlined, starting with _

1. member variables of a class

All exposed class constants : Defined as static final type, name all uppercase eg:public static final String Action_main = " Android.intent.action.MAIN ";

  static variable : Name begins with s eg:private static long sinstancecount = 0;

  non-static private variable, protected variable : Start with m eg:private Intent mintent;protected viewparent mparent;

2. Naming the method

  method Parameters : The name begins with p , which indicates the meaning of the Param eg:public int getcount (int pcount);

The local variables within the method begin with _ ,

eg public int getcount (int pcount) {

int _count;

}

This article transferred from: http://www.cnblogs.com/xiaoQLu/archive/2012/11/27/2790539.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.