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 Ending the Story

I don't understand where the program knows from if the page is the final.

I tried to fix the NullPointerException from the last video with the similar steps but i added an if statement to the Story.getPage() method which checks if pageNumber is >4 and calls mPages[pageNumber].setFinal(true); in case. Now i am facing the following problem: When pressing the "Play again"-button, i get another NullPointerException pointing to StoryActivity, the onClick-method in the else-block. This is what i don't understand because i thought that code would never be executed.

Thanks for your replies