LayoutInflater mLayoutInflater;
I have a question while I was looking at Android open source.
Many people put m at the beginning of the variable as above, and I wonder why.
naming-convention android
Android open source follows Naming Convention as below.
Follow Field Naming Conventions
//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#follow-field-naming-conventions If you go to the address above, you can see more detailed rules.
The above rules are only for the Android open source project, and you are free to create a personal Android app. When I made the Android app, I followed Java code convention. ;
For your information, the Java code style does not use Hungarian notation.
In order to improve readability, when developing a program, there are cases where a special abbreviation is added before the variable name according to the Hungarian nomenclature. It's not a linguistic feature or anything like that, so it doesn't have to be done as above, but depending on the development language or the project development team, you may use different naming conventions, which you can follow.
The prefix m you asked is an abbreviation for member (which means class variable or class member variable).
Usually, write the abbreviation for member(m)/global(g)/static(s) and type in order in the prefix.
For the type , write the following prefixes
For pointers, add a p prefix before the type.
© 2024 OneMinuteCode. All rights reserved.