Skip to content Skip to sidebar Skip to footer

Nullpointerexception Raised When Calling Adapterview On Itemselectedlistener For A Custom Spinner

I have this custom spinner(which has an icon and a number) and I am trying to get the value of the selected item on the spinner. I am using fragments and I seem to be getting some

Solution 1:

your CustomAdapter always returns null for all positions:

@OverridepublicObjectgetItem(int i) {
    returnnull;
}

change it to:

@OverridepublicObjectgetItem(int i) {
   return level[i];
}

maybe it results to null pointer exception

Post a Comment for "Nullpointerexception Raised When Calling Adapterview On Itemselectedlistener For A Custom Spinner"