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 Finishing the User Interface Loading the First Page

when i click the 'start your adventure" button it just shuts down

same as title

Frank Mascia
Frank Mascia
1,765 Points

Same here, getting a NullPointerException : Attempt to invoke virtual method 'int com.frankmascia.interactivestory.model.Page.getImageId()' on a null object reference

1 Answer

Frank Mascia
Frank Mascia
1,765 Points

Figured out the Error, In the Story.Java class I never had a pages[0]=new Page..... block of code, mine was beginning at pages[1]=new Page, therefore causing the null reference to pages[0] as it was never even there, hope that helps.

James N
James N
17,864 Points

this helped me out as well.. figured it was this but thought I should look it up to make sure... thanks!