THere a tons of question about android.util.AndroidRuntimeException: requestFeature() must be called before adding content
. But none of the proposed solutions worked for me.
I have a custom DialogFragment
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
return new AlertDialog.Builder(getActivity()).create();
}
@Override
public final View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.notification_dialog, null);
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
//setting up dialog
}
I'm showing it like this
newDialogInstance().show(activity.getFragmentManager(), "tag-dialog-fragment");
And each time I get:
android.util.AndroidRuntimeException: requestFeature() must be called before adding content
at com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java:226)
at com.android.internal.app.AlertController.installContent(AlertController.java:234)
at android.app.AlertDialog.onCreate(AlertDialog.java:337)
at android.app.Dialog.dispatchOnCreate(Dialog.java:355)
at android.app.Dialog.show(Dialog.java:260)
at android.app.DialogFragment.onStart(DialogFragment.java:490)
at android.app.Fragment.performStart(Fragment.java:1719)
Could someone explain me what is going on here?