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 Build a Weather App (2015) Hooking Up the Model to the View Setting the Weather Icon

Soumitra Mehrotra
Soumitra Mehrotra
337 Points

why did we use Drawable drawable=getResources().getDrawable(mcurrentWeather.getIconId());

we could have used mImageIconView.setImageResource(mCurrentWeather.getIconId()); this method accepts int resid, why dis we opt for Drawable?? any specific reason. And since we are in the context now, why are we even using getResources() ???

1 Answer

Ben Deitch
STAFF
Ben Deitch
Treehouse Teacher

Nope, no specific reason. If you've found a shorter way to write it, go for it :)