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!

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 Build a Weather App (2015) Working with JSON Setting the Weather Icon

getIcon() vs mIcon in if-else block conditions

In the if-else block comparisons, is using mIcon the same as using getIcon()? The mIcon member variable is an id string and the getIcon() method returns an id string so it does it matter? Is there a best practice regarding this?

if (getIcon().equals("clear-day")) { iconId = R.drawable.clear_day; }

in place of

if (mIcon.equals("clear-day")) { iconId = R.drawable.clear_day; }

Thank you! -- Ahmed