title: Add controls to custom dialog programmatically
body: <p>I want to show a dialog with ~50 custom controls (switch buttons) on it. So, the best way to do that is to add them programmatically in a loop. I've tried to make a dilog with a layout wich contains the only one GroupView element:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;LinearLayout
      android:layout_height="match_parent"
      android:layout_width="match_parent"
      android:orientation="vertical"
      android:background="#AAAAAA"
      xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;ViewGroup
          android:layout_height="500dp"
          android:layout_width="500dp"
          android:id="@+id/dlg_view"/&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>and then just add my controls in it using: onCreateDialog(...) method:</p>
  
  <pre><code>AlertDialog.Builder builder = new AlertDialog.Builder(this);
  LayoutInflater inflater = getLayoutInflater();
  builder.setView(inflater.inflate(R.layout.geomap_menu, null))
            .setPositiveButton("Ok", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int id) {
                   // sign in the user ...
                }
            })
            .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    //LoginDialogFragment.this.getDialog().cancel();
                }
  });
  
  Dialog res = builder.create();
  ViewGroup dlgView = (ViewGroup)res.findViewById(R.id.dlg_view);
  MyControl myControl = new MyControl(this);
  dlgView.add(myControl);
  </code></pre>
  
  <p>But it doesn't work this way (it throws InflateException). What am I doing wrong?</p>