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 an Interactive Story App (Retired) The Model-View-Controller Pattern Creating the Story

Android Studio and drawables

It seems Android Studio (or an API version) has deprecated drawables in favor of mipmap.

http://stackoverflow.com/questions/23935810/mipmap-drawables-for-icons/24066445#24066445

so where Ben says to place an image in the drawables folder you should use mipmap if your app folder structure has it e.g. drawables-mpdi should be mipmap-mpdi. when referencing them in code where Ben types (R.drawables.fileName) you should use (R.mipmap.fileName) if Android studio is giving you any grief.

1 Answer

Hello,

Actually drawables is still used, just not for icons. Mipmaps is only used for icons while drawables is still used for all other drawables that we might have(like all of the images that are used on each page of the app).

OK thanks for the heads up. When I tried to use the folder structure provided by Ben Android Studio wasn't loading them properly (drag /drop) once I put them in mipmap it worked. There is still the misleading issue where drawables is crossed out and when you hover it says its depricated. Hopefully they will clear this up in an AS release soon.

The Resources.getDrawable(id) method has been deprecated in API 22 in favor of the Resources.getDrawable(id, theme) method, except that it isn't usable in previous SDKs so instead we have to use ContextCompat.getDrawable(context, id) instead.