Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Ilya Liverts
9,677 PointsNull Pointer Exception in onListItemClick()
When I try to click on item ,Ribbit crashes with runtime exception:
04-17 10:53:31.691 1261-1261/com.teamtreehouse.ribbit E/AndroidRuntime? FATAL EXCEPTION: main java.lang.NullPointerException at com.teamtreehouse.ribbit.InboxFragment.onListItemClick(InboxFragment.java:70) at android.support.v4.app.ListFragment$2.onItemClick(ListFragment.java:58) at android.widget.AdapterView.performItemClick(AdapterView.java:298) at android.widget.AbsListView.performItemClick(AbsListView.java:1100) at android.widget.AbsListView$PerformClick.run(AbsListView.java:2788) at android.widget.AbsListView$1.run(AbsListView.java:3463) at android.os.Handler.handleCallback(Handler.java:730) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5103) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) at dalvik.system.NativeStart.main(Native Method)
1 Answer

william parrish
13,774 PointsWell, the error is giving you this information : NullPointerException at com.teamtreehouse.ribbit.InboxFragment.onListItemClick(InboxFragment.java:70) at android.support.v4.app.ListFragment$2.onItemClick(ListFragment.java:58)
That means on line 70 of your InboxFragment, and Line 58 of your ListFragment, you are referencing something that doesnt exist or cannot be found. Start at those lines, and make sure your variables are correct. If that doesnt work, post your code from those two Fragments so we can compare them.