title: how to add customised layout to Arrayadapter?
body: <p>I am trying to create a <code>ListView</code> with customized layout. each item in the <code>listView</code> should look like as shown in the <code>item.xml</code> posted below.</p>
  
  <p>in the code, i used </p>
  
  <pre><code>adapter = new ArrayAdapter&lt;T&gt;(getApplicationContext(), R.layout.listi_tems_layout, topicsList);
  </code></pre>
  
  <p>but it is not working because the constructor of the <code>ArrayAdapter&lt;T&gt;</code> accepts the second parameter as <code>int</code> something like </p>
  
  <p><code>android.R.layout.simple_list_item_1</code></p>
  
  <p>, and in my case it is customized layout which is </p>
  
  <pre><code>R.layout.listi_tems_layout
  </code></pre>
  
  <p>which adapter should i use or how to solve this. thanks</p>
  
  <p><strong>Item</strong>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout 
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:orientation="horizontal"
  android:weightSum="3"&gt;
  
  &lt;TextView 
      android:id="@+id/tvlist_topic"
      android:layout_width="0dp"
      android:layout_height="wrap_content"
      android:layout_weight="1"/&gt;
  &lt;ImageView 
      android:id="@+id/ivList_delete"
      android:layout_width="0dp"
      android:layout_height="wrap_content"
      android:clickable="true"
      android:src="@drawable/delete_icon"
      android:contentDescription="icon to delete item from the Listview"
      android:layout_weight="1"/&gt;
  &lt;CheckBox 
      android:id="@+id/cbList_hook"
      android:layout_width="0dp"
      android:layout_height="wrap_content"
      android:checked="false"
      android:layout_weight="1"/&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>mainlayout</strong>:</p>
  
  <pre><code>&lt;RelativeLayout 
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  tools:context="${relativePackage}.${activityClass}" &gt;
  ....
  ....
  ....
  
  &lt;ListView 
      android:id="@+id/lvEco_topics"
      android:layout_width="match_parent"
      android:layout_height="470dp"
      android:layout_below="@id/tvEco_topic"
      android:layout_marginTop="30dp"
      android:scrollbars="vertical"
      android:divider="@android:drawable/alert_light_frame"&gt;&lt;/ListView&gt;
  &lt;Button 
      android:id="@+id/btEco_save"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_below="@id/lvEco_topics"
      android:gravity="center"
      android:text="Save"/&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>code</strong>:</p>
  
  <pre><code>public class MainActivity extends Activity {
  
  private ArrayList&lt;String&gt; topicsList;
  private ListAdapter adapter;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main_activity);
  
      topicsList = new ArrayList&lt;String&gt;();
      topicsList.add("topic1");
      topicsList.add("topic2");
      topicsList.add("topic3");
      topicsList.add("topic4");
      topicsList.add("topic5");
      topicsList.add("topic6");
  
      adapter = new ArrayAdapter&lt;T&gt;(getApplicationContext(), R.layout.listi_tems_layout, topicsList);
  </code></pre>