title: How to Add RelativeLayout to ListView Dynamically
body: <p>I'm just beginning with android and have not for the life of me been able to figure this out. Thanks in advance to everyone!</p>
  
  <p>I have a list view within my alert dialogue. I want each item of this listview (id=dialoguelist) to be a relative layout which is in item.xml layout file (as shown below):</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/receipt_items"&gt;    
      &lt;EditText
          android:id="@+id/Item"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:layout_marginTop="5dp"          
          android:hint="@string/Item" 
          /&gt;
  
      &lt;EditText
          android:id="@+id/Quantity"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_marginTop="15dp"
          android:layout_alignParentLeft="true"
          android:hint="@string/Quantity" 
          android:layout_below="@id/Item"/&gt;
  
      &lt;EditText
          android:id="@+id/Cost"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_marginTop="15dp"
          android:layout_toRightOf="@id/Quantity"
          android:hint="@string/Cost" 
          android:layout_below="@id/Item"/&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>I need this relative layout to be added dynamically when the NeutralButton in the alert dialog is pressed. I have tried using an arrayadapter but don't know how to implement it when the item I want to add is not a String. </p>
  
  <p>I have also included (below) a portion of my main_activity.java file which opens up the alert dialogue:</p>
  
  <pre><code> // Inflate and set the layout for the dialog
      // Pass null as the parent view because its going in the dialog layout
      builder.setView(inflater.inflate(R.layout.add_receipt_custom_alert, null))
             .setTitle("New Receipt")
      // Add action buttons
             .setPositiveButton("Save", new DialogInterface.OnClickListener() {
             public void onClick(DialogInterface dialog, int which) { 
              // continue with delete
            }
          })
          .setNeutralButton("Add Item", new DialogInterface.OnClickListener() {
             public void onClick(DialogInterface dialog, int which) { 
  
  
  
  
         //////What should I do here to add the relative layout to the list dynamically?  
  
  
  
            }
          })
          .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
  
          public void onClick(DialogInterface dialog, int which) { 
              // do nothing
            }
          })
          .show();
  </code></pre>
  
  <p>In the area marked, what type of adapter would I need to make this happen and how would I make that work? Thanks bunches!</p>