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 trialRoope Jourio
7,308 PointsSetting icon in CurrentWeather.java
I have my in-app images in
drawable-> [drawable-hdpi, drawable-mdpi, drawable-xdpi, drawable-xxdpi]
The IDE doesn't seem to find the files when I call
public int getIconId() {
int iconId = R.drawable.clear_day;
if (mIcon.equals("clear-day")) {
iconId = R.drawable.clear_day;
}
else if (mIcon.equals("clear-night")) {
iconId = R.drawable.clear_night;
}
else if (mIcon.equals("rain")) {
iconId = R.drawable.rain;
}
else if (mIcon.equals("snow")) {
iconId = R.drawable.snow;
}
else if (mIcon.equals("sleet")) {
iconId = R.drawable.sleet;
}
else if (mIcon.equals("wind")) {
iconId = R.drawable.wind;
}
else if (mIcon.equals("fog")) {
iconId = R.drawable.fog;
}
else if (mIcon.equals("cloudy")) {
iconId = R.drawable.cloudy;
}
else if (mIcon.equals("partly-cloudy-day")) {
iconId = R.drawable.partly_cloudy;
}
else if (mIcon.equals("partly-cloudy-night")) {
iconId = R.drawable.cloudy_night;
}
return iconId;
}
"Cannot resolve symbol 'clear_day'" (It says this for all of the icons in getIconId method)
What I've done so far:
checked 100 times that the files are in drawable-> [drawable-hdpi, drawable-mdpi, drawable-xdpi, drawable-xxdpi]
Gone to Build->Clean project
deleted and re-added the folders in to drawable.
I Don't know what else to do... :( Please help me!
EDIT: https://github.com/Jourio/AndroidApps/tree/master/WeatherApp/Stormy
1 Answer
Calin Bogdan
14,921 PointsHowdy!
The drawable-hdpi, drawable-mdpi, drawable-xdpi, drawable-xxdpi folders have to be in the same folder as the drawable folder.
Instead of res > drawable > drawable-hdpi, drawable-mdpi, drawable-xdpi, drawable-xxdpi it should be res > drawable, drawable-hdpi, drawable-mdpi, drawable-xdpi, drawable-xxdpi
That should fix your issue.
Good luck!
Roope Jourio
7,308 PointsRoope Jourio
7,308 PointsYes I just figured this out after going back in the videos and checking the folder structure..
Thank you for the answer!