title: ArrayAdapter for more then one class type
body: <p>What are the best practice to have array adapter which can handle multiple object types?</p>
  
  <p><code>Adapter extends ArrayAdapter&lt;?&gt;</code></p>
  
  <p>I have 3 type of classes <code>A.class</code>, <code>B.class</code>, <code>C.class</code> and the logic in adapter is identical.</p>
  
  <pre><code>public class Adapter extends ArrayAdapter&lt;A,B,C ?&gt; {
  
  private int viewResourceId;
  private LayoutInflater inflater;
  private ArrayList&lt;A,B,C ?&gt; list;
  
  public Adapter(Context context, int viewResourceId, ArrayList&lt;A,B,C ?&gt; list) {
      super(context, viewResourceId, list);
      this.viewResourceId = viewResourceId;
      this.list = list;
  
      inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  }
  
  @Override
  public int getCount() {
      return list.size();
  }
  
  @Override
  public View getView(int arg0, View arg1, ViewGroup arg2) {
      Holder holder;
  
      if (arg1 == null || arg1.getTag() == null) {
          holder = new Holder();
  
          arg1 = inflater.inflate(viewResourceId, null);
          arg1.setTag(holder);
  
          holder.textView = (TextView) arg1.findViewById(R.id.textView);
      } else {
          holder = (Holder) arg1.getTag();
      }
  
      // A,B,C
      holder.textView.setText(list.get(arg0).getName());
  
      return arg1;
  }
  
  static class Holder {
      TextView textView;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>For now I have 3 different adapters for every class type and set it to list </p>
  
  <p><code>listView.setAdapter(new Adapter(this, R.layout.row_item, list&lt;A,B,C ?&gt;))</code></p>