I cannot reproduce this bug, but it is live on production and firebase is telling me that this is a common crash. I am not sure how to reproduce this bug because everytime I go into the fragment it works fine on my end. I am not sure how to resolve this since I am a novice to Android.
java.lang.NullPointerException: Attempt to invoke virtual method 'android.graphics.drawable.Drawable android.widget.Spinner.getBackground()' on a null object reference
Positions Fragment (Took some unrelated code out due to security concerns)
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
spinner = getToolbarSpinner().getBackground();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
View view = inflater.inflate(R.layout.fragment_positions, container, false);
}
___________________
View.java
/**
* Gets the background drawable
*
* @return The drawable used as the background for this view, if any.
*
* @see #setBackground(Drawable)
*
* @attr ref android.R.styleable#View_background
*/
@InspectableProperty
public Drawable getBackground() {
return mBackground;
}