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) Finishing the User Interface Loading Additional Pages

Drawable drawable = getResources().getDrawable(page.getImageId());

Drawable drawable = getResources().getDrawable(page.getImageId()); getDrawable is deprecated

PLS help! :(

3 Answers

Hi 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. :+1:

Steve.

I 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 :(

Waldo Alvarado
Waldo Alvarado
16,322 Points

Damjam,

This is what I have which is working for me: Drawable drawable = ResourcesCompat.getDrawable(getResources(), mCurrentPage.getImageID(), null);

fixed yesterday :) but ty :D