Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Android Lists and Adapters (2015) Updating the Data Model Adding a New Data Model Object

Darean Wong
PLUS
Darean Wong
Courses Plus Student 4,186 Points

'm' prefix in class variables

Why use 'm' before all class variables? Is that a common convention among Android developers? If so, would it be considered bad practice to just call time as simply 'private long time' instead of 'private long mTime'?

1 Answer

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Darean;

Yes, it is common in Android development to prefix member variables with m. You can, of course, call variables whatever is easiest for you, but if you are working on projects with other developers you will typically find mTime or occasionally this.time for member variables in code.

Happy coding and great question.

Ken