title: onclick Listener for custom listview
body: <p>I am developing an android application with a custom list view ( with a single image and two text views)</p>
  
  <p>The class mainactivity has .... </p>
  
  <pre><code>public class MainActivity extends ActionBarActivity {
  String[] memetitles;
  String[] memedesc;
  ListView list;
  int[] images = {R.drawable.angry_icon,R.drawable.happy_icon,R.drawable.kid_icon,R.drawable.scare_icon,R.drawable.warn_icon};
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      Resources res = getResources();
      memetitles = res.getStringArray(R.array.titles);
      memedesc = res.getStringArray(R.array.notneed);
      list = (ListView) findViewById(R.id.listView1);
      Itarray adapter = new Itarray(this,memetitles,memedesc,images);
      list.setAdapter(adapter);
      setTitle("Tamil Memer");
  }
  </code></pre>
  
  <p>The class for combining two layouts into a single list view has </p>
  
  <pre><code>class Itarray extends ArrayAdapter&lt;String&gt;{
  Context context;
  int[] image;
  String[] tit1;
  String[] tit2;
  Itarray(Context c , String[] titles ,String[] notneed, int imgs[])
  {
      super(c , R.layout.single_row,titles);
      this.context = c;
      this.image = imgs;
      this.tit1 = titles;
      this.tit2 = notneed;
  }
  
      public View getView(int position, View convertView, ViewGroup parent) {
          // TODO Auto-generated method stub
          View row = convertView;
          if(row == null)
          {
          LayoutInflater inf = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
          row = inf.inflate(R.layout.single_row , parent , false);
          }
          ImageView myImage = (ImageView) row.findViewById(R.id.imageView1);
          TextView tit = (TextView) row.findViewById(R.id.textView1);
          TextView des = (TextView) row.findViewById(R.id.textView2);
          myImage.setImageResource(image[position]);
          tit.setText(tit1[position]);
          des.setText(tit2[position]);
          return row;
      }   
  </code></pre>
  
  <p>}</p>
  
  <p>The two layout files : 
  (the one with the image and the textviews)</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"
  android:gravity="top"
  android:paddingBottom="@dimen/activity_vertical_margin"
  android:paddingLeft="@dimen/activity_horizontal_margin"
  android:paddingRight="@dimen/activity_horizontal_margin"
  android:paddingTop="@dimen/activity_vertical_margin"
  tools:context="com.itassistors.tmg.MainActivity" &gt;
  
  &lt;TextView
      android:id="@+id/textView1"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:layout_alignParentRight="true"
      android:layout_alignParentEnd="true"
      android:layout_toEndOf="@+id/imageView1"
      android:layout_toRightOf="@+id/imageView1"
      android:text="@string/simple"
      android:textAppearance="?android:attr/textAppearanceLarge" /&gt;
  
  &lt;TextView
      android:id="@+id/textView2"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:layout_alignBottom="@+id/imageView1"
      android:layout_alignLeft="@+id/textView1"
      android:layout_alignStart="@+id/textView1"
      android:text="@string/simple"
      android:textAppearance="?android:attr/textAppearanceSmall" /&gt;
  
  &lt;ImageView
      android:id="@+id/imageView1"
      android:layout_width="50dp"
      android:layout_height="50dp"
      android:layout_alignParentLeft="true"
      android:layout_alignTop="@+id/textView1"
      android:src="@drawable/happy_icon" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>(the one with the listview)</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"
  android:gravity="center_vertical"
  android:paddingBottom="@dimen/activity_vertical_margin"
  android:paddingLeft="@dimen/activity_horizontal_margin"
  android:paddingRight="@dimen/activity_horizontal_margin"
  android:paddingTop="@dimen/activity_vertical_margin"
  tools:context="com.itassistors.tmg.MainActivity" &gt;
  
  &lt;ListView
      android:id="@+id/listView1"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_alignParentTop="true"
      android:layout_centerHorizontal="true" &gt;
  &lt;/ListView&gt;
  </code></pre>
  
  <p></p>
  
  <p>I want to know how and where to place the onClickListener() for this custom list view 
  Thanks in advance </p>