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

Travis Avey
Travis Avey
18,876 Points

Use mipmap instead of drawable, Android Studio 1.1

In the video Creating the story we add the image to page 0.

mPages[0].setImageId(R.drawable.page0);

I am using Android Studio 1.1, it's now a little different:

mPages[0].setImageId(R.mipmap.page0);

Just thought I'd share in case anyone was wondering how to get those drawables to work!

I noticed this change too, but can anyone confirm that mipmap is the intended place to put images now? In this google blog they mention mipmap, but only in regard to icons, not app images. Of course they don't explicitly state anything about the drawable folder... http://android-developers.blogspot.co.uk/2014/10/getting-your-apps-ready-for-nexus-6-and.html

Here is a giant Stackoverflow thread that doesn't really answer it either http://stackoverflow.com/questions/23935810/mipmap-drawables-for-icons

Zaw Mai
Zaw Mai
1,605 Points

Hey Travis, as Joe Redding have stated and linked to the android dev blog. I read mipmap sub-folders are reserved for icons. So, I just made a new android resource directory for drawable type under the res directory. This will organizes the image resources according to the types Android guidelines and the lessons have mentioned. What I did was: Right Click "res" folder -> Select "Android Resource Directory" -> Under Resource Type, selectt drawable -> Create Folders. I made 4 of them for the hdpi, mdpi, xhdpi, and xxhdpi.

Josh Gold
Josh Gold
12,207 Points

It appears that Android Asset Studio creates images automatically for you, including all the separate drawable folders for each resolution.

https://romannurik.github.io/AndroidAssetStudio/nine-patches.html

I didn't understand if this tool was for all images, or just certain kinds of images. But the tool seemed to do the job.

Thanks a lot!