I\'m trying to create a DialogFragment using a custom view in an AlertDialog. This view must be inflated from xml. In my DialogFragment
I had the same problem. In my case it was becasue Android Studio created a template onCreateView that re-inflated a new view instead of returning the view created in onCreateDialog. onCreateView is called after onCreateDialog, so the solution was to simply reurnt the fragments view.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
return this.getView();
}