title: How to pass dynamically android xml layout as argument to custom array adapter class
body: <p>We are making a dynamic custom array adapter for our android project. Now we need to pass dynamic android layout object and other data source as argument when initialize this custom adapter class. After that everything will be dynamic.</p>
  
  <pre><code>public class CustomAdapterView extends ArrayAdapter&lt;String&gt; {
  private Activity context;
  private String[] googleProducts;
  private String[] productDescription;
  private Integer[] productImage;
  private Layout listItemLayout;
  
  public CustomAdapterView(Activity context, Layout listItemLayout, String[] googleProducts, String[] productDescription, Integer[] productImage) {
  
      super(context, R.layout.content_custom_listview, googleProducts);
      // Tring to do this
      //super(context, listItemLayout, googleProducts);
      //Error: Cannot resolve method 'super(android.app.Activity, android.text.Layout, java.lang.String[])'
  
      // Set Local Property
      this.context = context;
      this.googleProducts = googleProducts;
      this.productDescription = productDescription;
      this.productImage = productImage;
  }
  </code></pre>
  
  <p>Now in the super() method we want to pass dynamic Layout for displaying custom list view.</p>
  
  <pre><code>super(context, listItemLayout, googleProducts);
  </code></pre>
  
  <blockquote>
    <p>//Error: Cannot resolve method 'super(android.app.Activity,
    android.text.Layout, java.lang.String[])'</p>
  </blockquote>
  
  <p>Than call that from any Activity</p>
  
  <pre><code>// Initialize
      ListView lv = (ListView) findViewById(R.id.custom_listview);
      Layout dynamicLayout = null;
  
      // Our Custom Adapter Object
      CustomAdapterView cav = new CustomAdapterView(this, dynamicLayout, googleProducts, productDescription, productImage);
      //Set Adapter
      lv.setAdapter(cav);
  </code></pre>