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 Android Lists and Adapters (2015) Using Parcelable Data Retrieving Parcelable Data

Jakob Wozniak
Jakob Wozniak
17,896 Points


Hi everybody! I just spent a good chunk of time trying to figure out this error I was getting, so I thought I'd share the answer and the technique for finding it. My app kept shutting down when I tapped the 7 DAY VIEW button, and I'd get this long error:

java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.View.getImportantForAccessibility()' on a null object reference at android.widget.AbsListView.obtainView(AbsListView.java:2363) at android.widget.ListView.makeAndAddView(ListView.java:1875) at android.widget.ListView.fillDown(ListView.java:702) at android.widget.ListView.fillFromTop(ListView.java:763) at android.widget.ListView.layoutChildren(ListView.java:1684)

It goes on and on. I tried checking all the answers here for the video, but no one seemed to have this same problem. I googled the first part of the error (through "on a null object reference at android.widget"), and found a StackTrace post about it.

Turns out, I was returning null on my "public View getView" method in the DayAdapter, and all I needed was to change it to return convertView.

Hope this helps someone out there!