The fact is that my MainActivity is a BottomBarNavigation Activity, which has three fragments where all the elements are loaded so that the user can interact. In one of those fragments there is a list in which, when the user selects an item, the application must show a personalized DialogFragment where the user must enter some other data.
The problem is, that when I work with that DialogFragment and try to access the components with findViewByID, something goes wrong because they remain null. The code that I use to access the components is the same one that I use in the other fragments and I had not given any errors until now.
This is my onCreateView method. in spite of assigning the component to the spinner, when the loadSpinner () method enters in which an adapter is associated with it, I get a nullPointer in the spinner
public class DialogSeleccion extends DialogFragment{
Spinner spinner;
View view;
public DialogSeleccion(){}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstances) {
view = inflater.inflate(R.layout.dialog_seleccion_layout, container);
spinner= (Spinner) view.findViewById(R.id.spinnerPrueba);
cargaSpinner();
return view;
}
}