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 trialDamjan Ošlaj
1,200 PointsDrawable drawable = getResources().getDrawable(page.getImageId());
Drawable drawable = getResources().getDrawable(page.getImageId()); getDrawable is deprecated
PLS help! :(
3 Answers
Steve Hunter
57,712 PointsHi Damjam,
Have a look at these posts to see if they help you out:
https://teamtreehouse.com/community/deprecated-getresourcesgetdrawablein-id
https://teamtreehouse.com/community/getdrawableint-id-is-deprecated-in-api-22
Let me know how you get on.
Steve.
Waldo Alvarado
16,322 PointsDamjam,
This is what I have which is working for me: Drawable drawable = ResourcesCompat.getDrawable(getResources(), mCurrentPage.getImageID(), null);
Damjan Ošlaj
1,200 Pointsfixed yesterday :) but ty :D
Damjan Ošlaj
1,200 PointsDamjan Ošlaj
1,200 PointsI tried everything but it's not working :( I tried this Drawable drawable = ContextCompat.getDrawable(this, R.drawable.page1); it doesnt give any errors but in the text it doesn't change image and %1$s is not being replaced :(