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 the First Page

Hasan Nagaria
Hasan Nagaria
4,855 Points

Deprecation??

I get a striked out line across the top of my code as well as at some points in the code. Reading the other questions I made the following changes.

getResources().getDrawable(mCurrentPage.getImageId());

to

ContextCompat.getDrawable(this, mCurrentPage.getImageId());

I also changed ActionBarActivity with AppCompatActivity at the top.

This solved some problems. But later my app crashes when i try to navigate away from the first page. I enter my name and it goes to the next activity. Now when I click on one of the two buttons the app crashes.

These two are the only places where I have deviated from bens code, I have a funny feeling that this is where the problem is as well.

Hasan Nagaria
Hasan Nagaria
4,855 Points

I was able to solve my problem, however I dontknow how it worked. Initially since Im using the new android studio I had just one drawable folder so to be on the "safe side" I had put only the pictures of the highest resolution. I kept getting an error saying something like I have run out of memory which makes little sense to me. So i changed to the lowest resolution and it worked?

1 Answer

There is a memory limit for bitmaps some devices will have a limit as low as 16mb for an Application. You can read more about showing bitmaps efficiently here http://developer.android.com/intl/ru/training/displaying-bitmaps/index.html