Skip to content Skip to sidebar Skip to footer

Weird Nullpointerexception Not Hints (null's In Data Of The Arrayadaptor On Spinner)

Exception, nothing beyond this. Normally logcat has more useful information, but in this case, sadly not much. 07-06 13:26:26.654: E/AndroidRuntime(726): java.lang.NullPointerExcep

Solution 1:

That NullPointerException appears most likely because you have null values in the array/List that you pass in the ArrayAdapter's constructor for one of your Spinners.

By default an ArrayAdapter will call the method toString on the data items and use that to set the text on the row's TextView if the type of data for the ArrayAdapter is not of type CharSequence.

Print the values of your data arrays(vehicleList and Globals.TIME_WINDOW) and make sure you don't have null values in them.

Solution 2:

There must be some other stuff missing that you should post. Can't really debug your error just from that (both the XML and JAVA files). However, just from looking at your XML, seems like you can just use a RelativeLayout inside of your scrollview because you are doing a lot of LinearLayout nesting. Which anytime you have to draw more views, it's not only hard to go though (which it happening now) but also hurts the performance of your app.

Solution 3:

I still think the problem is with the xml, but let's go:

1 - I don't see any vehicleList id Spinner on your xml. Are you sure this id exists?

2 - I think this vehicleList in your activity is an array? Did you populate it? Or is it null?

3 - Maybe the problem could be the startInMinutes spinner with a Long Array.

Post a Comment for "Weird Nullpointerexception Not Hints (null's In Data Of The Arrayadaptor On Spinner)"