user1903985 user1903985 - 1 year ago 127
Android Question

Android DialogFragment is blank

I have a problem with creating a dialog. It does appear, but its empty inside, just a blank box is shown.

Dialog class:

public class SomeDialog extends DialogFragment{

public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
LayoutInflater inflater = getActivity().getLayoutInflater();

builder.setView(inflater.inflate(R.layout.somelayout, null));

return super.onCreateDialog(savedInstanceState);

In an activity, creating an object and calling show method:

SomeDialog obj = new SomeDialog();, "randomtag");

Answer Source
return super.onCreateDialog(savedInstanceState);

You are returning the parent method. You should return your own . Change to :

 return builder.create();
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download