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

Joyce Chidiadi
Joyce Chidiadi
1,867 Points

My app crashes once I tap the button to move to the next page

I followed all the steps but my app still can't move to the next page

2 Answers

Joyce Chidiadi
Joyce Chidiadi
1,867 Points

I have checked the choices, still crashes. Here is the error log statements I get (among other log messages) when I run the app:

@BenDeitch / @BenJakuben please help.

02-14 14:37:52.212 11756-11756/joycechidiadi.com.weatherappy D/AndroidRuntime: Shutting down VM 02-14 14:37:52.217 11756-11756/joycechidiadi.com.weatherappy E/AndroidRuntime: FATAL EXCEPTION: main Process: joycechidiadi.com.weatherappy, PID: 11756 java.lang.NullPointerException: Attempt to invoke virtual method 'joycechidiadi.com.weatherappy.weather.Day[] joycechidiadi.com.weatherappy.weather.Forecast.getDailyForecast()' on a null object reference at joycechidiadi.com.weatherappy.ui.AppyActivity.startDailyActivity(AppyActivity.java:274) at joycechidiadi.com.weatherappy.ui.AppyActivity_ViewBinding$1.doClick(AppyActivity_ViewBinding.java:42) at butterknife.internal.DebouncingOnClickListener.onClick(DebouncingOnClickListener.java:22) at android.view.View.performClick(View.java:5697) at android.widget.TextView.performClick(TextView.java:10826) at android.view.View$PerformClick.run(View.java:22526) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:158) at android.app.ActivityThread.main(ActivityThread.java:7225) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 02-14 14:37:55.217 11756-11756/joycechidiadi.com.weatherappy I/Process: Sending signal. PID: 11756 SIG: 9

I don't know what this means and can't decipher where the problem is.

David Seitz Jr
David Seitz Jr
3,363 Points

Joyce, is that for the Interactive Story app? I see references to a "weatherappy" and "getDailyForecast()". I wonder if you might be asking your question in the wrong thread... !

Regardless, it looks like you've got a problem with a null pointer. That may be because you're trying to access a property that hasn't be set yet...

David Seitz Jr
David Seitz Jr
3,363 Points

Check to make sure your buttons have been set up properly. When copying things for choice1 and choice2, it can be easy to miss a line where choice1 should've been changed to choice2.