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

app crashes when i click button

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.