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 trialLuis Rios
3,149 PointsGetting an error java.lang.NullPointerException in ListAdapter.java. How do I fix this?
When attempting to run the program, I'm getting this error:
Process: rioscreative.com.golfscorecard, PID: 4011
java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.view.View.findViewById(int)' on a null object reference at rioscreative.com.golfscorecard.ListAdapter.getView(ListAdapter.java:44)
The code referenced reads as follows:
LayoutInflater.from(mContext).inflate(R.layout.list_item, null);
It doesn't seem to like the null value. Did I miss something?
Dale Caffull
5,421 PointsYou forgot to set convertView to your inflated layout:
convertView = LayoutInflater.from(mContext).inflate(R.layout.list_item, null);
Ben Deitch
Treehouse TeacherBen Deitch
Treehouse TeacherCan you post you're getView method?