In my android application I have a dialog box in which the user inputs info into an EditText and saves the data. Everything so far worked fine until I added an inputType to the EditTexts. I can’t seem to find the solution to this problem, I’m rather new to android programming and programming in general so it might be a dumb mistake but I can’t figure it out. Here some of the code:
private Dialog dialog() {
Dialog diUnit = new Dialog(Overzicht.this);
diUnit.setContentView(R.layout.unitdialog);
EditText etKM = (EditText) diUnit.findViewById(R.id.etKM);
etKM.setInputType(InputType.TYPE_CLASS_NUMBER);
diUnit.setTitle("Add unit");
diUnit.setCancelable(false);
diUnit.getWindow().getAttributes().width = LayoutParams.FILL_PARENT;
bUnitDialogSave = (Button) diUnit.findViewById(R.id.bUnitDialogVoegToe);
bUnitDialogCancel = (Button) diUnit.findViewById(R.id.bUnitDialogCancel);
bUnitDialogCancel.setOnClickListener(this);
bUnitDialogAdd.setOnClickListener(this);
return diUnit;
}
And the logcat :

I know it’s not storing the EditText input yet but the problem starts as soon as I add the setInputType line.
Try to inflate the layout
R.layout.unitdialoginto aView(with theLayoutInflater) and then search for thatEditTextin the inflatedView: