title: DialogFragment with RecyclerView issue in onCreateDialog
body: <p>I need to add in my DialogFragment positive/negative button.
  This is the dialog without these buttons:
  <a href="https://i.stack.imgur.com/DTGxl.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DTGxl.jpg" alt="enter image description here"></a></p>
  
  <p>and this is the code I've used to implement it:</p>
  
  <pre><code>public class RecyclerColorsDialogFragment extends DialogFragment
  {
  
  RecyclerView recyclerView;
  RecyclerColorsDialogAdapter adapter;
  ArrayList&lt;Boolean&gt;colorChecked;
  ArrayList&lt;String&gt;items;
  ArrayList&lt;String&gt;colors;
  
  public Dialog onCreateDialog(Bundle savedInstanceState)
  {
      Dialog dialog = new Dialog(getActivity());
      dialog.setCancelable(true);
  
  
  
      return dialog;
  }
  
  public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState)
  {
     View rootView = inflater.inflate(R.layout.fragment_recycler_colors_dialog, container, false);
  
      colorChecked = new ArrayList&lt;&gt;(12);
      colors = new ArrayList&lt;&gt;(12);
  
      String[] cItems = {getString(R.string.red),getString(R.string.green), getString(R.string.blue),getString(R.string.yellow),
      getString(R.string.azur),getString(R.string.black),getString(R.string.white),getString(R.string.gray),getString(R.string.brown),
      getString(R.string.pink),getString(R.string.purple)};
  
      items = new ArrayList&lt;&gt;(Arrays.asList(cItems));
  
      //inizializzo i check a false
      for (int i = 0; i&lt; items.size(); i++)
       colorChecked.add(true);
  
      recyclerView = (RecyclerView)rootView.findViewById(R.id.recColors);
      adapter = new RecyclerColorsDialogAdapter(getActivity(),colors,colorChecked,items);
  
      final Dialog dialog = getDialog();
  
      dialog.setCancelable(true);
      dialog.setTitle("Add a picture to your aircraft:");
  
      recyclerView.setHasFixedSize(true);
      recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
      recyclerView.addItemDecoration(new SimpleDividerItemDecoration(getActivity()));
      recyclerView.setAdapter(adapter);
  
  
  
      return rootView;
  }
  
  @Override
  public void onCancel(DialogInterface dialog)
  {
      super.onCancel(dialog);
  }
  
  @Override
  public void onDismiss(DialogInterface dialog) {
      super.onDismiss(dialog);
      dialog.cancel();
  }
  }
  </code></pre>
  
  <p>and it's the call from other fragment:</p>
  
  <pre><code>final RecyclerColorsDialogFragment dialog = new RecyclerColorsDialogFragment();
      dialog.setTargetFragment(AddAicraftFivePartFragment.this, 2);
  
  
      logo.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              FragmentManager manager = getActivity().getSupportFragmentManager();
              dialog.show(manager, "PATAG");
  </code></pre>
  
  <p>I have a problem when I try to do it in <code>onCreateDialog()</code>:</p>
  
  <pre><code>public Dialog onCreateDialog(Bundle savedInstanceState)
  {
   //        Dialog dialog = new Dialog(getActivity());
   //       dialog.setCancelable(true);
  
  return new AlertDialog.Builder(getActivity())
              .setCancelable(true)
              .setPositiveButton("OK",
                      new DialogInterface.OnClickListener() {
                          public void onClick(DialogInterface dialog, int whichButton) {
                              // do something...
                          }
                      }
              )
              .setNegativeButton("Cancel",
                      new DialogInterface.OnClickListener() {
                          public void onClick(DialogInterface dialog, int whichButton) {
                              dialog.dismiss();
                          }
                      }
              ).create();
  
  
     // return dialog;
  }
  </code></pre>
  
  <p>because it shows it:
     <a href="https://i.stack.imgur.com/EUekq.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EUekq.jpg" alt="enter image description here"></a></p>
  
  <p>without recyclerview with items.<br>
     How could I fix it?</p>
  
  <p>Thanks </p>