You need to first call the
getView()
function to get the view of the fragment and then you can call the
findViewById()
.
Like this,
private EditText city = (EditText) getView().findViewById(R.id.cityDialog);
Now it should work. Or you can use the
getActivity()
for the fragment because you cannot directly call
findViewById()
in a Fragment or DialogFragment and so on. Also, you should check and execute these functions in
onActivityCreated()
event.