Why do most fields (class members) in Android tutorial start with `m`?
This notation comes from AOSP (Android Open Source Project) Code Style Guidelines for Contributors:
Follow Field Naming Conventions
- 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.
Note that the linked style guide is for code to be contributed to the Android Open Source Project.
It is not a style guide for the code of individual Android apps.
Why do variable names often start with the letter 'm'?
It stands for member. I personally find this convention unhelpful, but it's subjective.
Android programming m before objects
Follow Field Naming Conventions
- 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.
You can see the document on those rules here.
Why does this Android developer doc name some of its variables with TWO m's
I don't know for sure, but I suspect it is meant to signify a sub-class private non-static variable.
Which field names get prefix 'm'?
In your second example, mMethodFieldOne
and mMethodFieldTwo
are not fields, just variables local to someMethod
, so the naming convention does not apply.
What does mInflator stand for?
m stands for "member". it is a convention for naming member variables. They are variables defined outside of any methods but inside the class and are used in different methods. member variables often said as fields in java / android studio
Related Topics
Android Webview with Garbled Utf-8 Characters
Update Listview Dynamically with Adapter
How to Start Android Application Info Screen Programmatically
Android How to Turn on Do Not Disturb (Dnd) Programmatically
Get JSON Data from Url Using Android
How to Add Button Tint Programmatically
Android, How to Not Destroy the Activity When I Rotate the Device
Gradle Version 2.2 Is Required. Current Version Is 2.10
Is Using Serializable in Android Bad
Apache Httpclient on Android Producing Certpathvalidatorexception (Issuername != Subjectname)
Catch on Swipe to Dismiss Event
Update Android Sdk Tool to 22.0.4(Latest Version) from 22.0.1
How to Perform an SQLite Query Within an Android Application
Android - Keep Listview's Item Highlighted Once One Has Been Clicked
Android Vpnservice to Capture Packets Won't Capture Packets