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) User Input Introducing ImageViews

NEW version: no different folders for different dpi's, there must be different filenames. Am I right?HowShouldItBeDone?

When I tried to "load" the picture in the src property of the ImageView, I got stuck. The new version does not require separate folders for different dpi pictures. As I see, it's not like there is no need for separate folders, but it doesn't even work the old way. In my (new version of) Android Studio, ImageView's src property only sees the files in the drawable folder directly, can not convert to drawable from a subdirectory of drawable folder.

If there is no need for separate folders, there must be a need for different file names for different dpi's. Am I right? And how should it be done?

2 Answers

Seth Kroger
Seth Kroger
56,414 Points

The "drawable-*dpi" folders need to be in the res directory alongside "drawable", not inside "drawable".

i am also facing the same issue. When i created the project, i only see drawable directory. there are no drawable-dpi* directories. Can i copy all the images in the drawable directory?

there is only a drawable directory at first. you can copy the drawable-dpi directories as they are, but note that you have to copy them directly into the res directory, NOT into the drawable directory. so the drawable, drawable-dpi directories should be near each other in the res directory, and NOT the drawable-**pi directories inside the drawable directory!

Like this:

res/drawable res/drawable-mdpi res/drawable-hdpi res/drawable-xhdpi res/drawable-xxhdpi