title: CustomListView OnItemClickListener not working
body: <p>I used a local database to fetch records and create a custom list view using that. The custom list view gets displayed perfectly. Problem is with Onitemclicklistener. It doesn't do anything on click. My aim is to send the position of clicked item to another activity. I implemented it but it's not working. 
  Screenshot of list view - 
      <a href="https://www.dropbox.com/s/pz83i162sxdv2b0/Untitled.png?dl=0" rel="nofollow">https://www.dropbox.com/s/pz83i162sxdv2b0/Untitled.png?dl=0</a></p>
  
  <p>Here is my MainActivity.java : </p>
  
  <pre><code>public class MainActivity extends ActionBarActivity {
  ListView lv;
  TextView tv1,tv2,tv3;
  ArrayList&lt;String&gt; a=new ArrayList&lt;String&gt;();
  String mydata,name,name1;
  public String[] s1 = new String[50];
  public int[] img = {R.drawable.rty, R.drawable.sf, R.drawable.rty};
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      tv1=(TextView)findViewById(R.id.textView);
      lv = (ListView) findViewById(R.id.listView);
      new MyData().execute();
  
      lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
  
              Intent in = new Intent(MainActivity.this, listclick.class);
              in.putExtra("position", position);
              startActivity(in);
          }
      });
  }
  public void abc(View v)
  {
      Intent in=new Intent(MainActivity.this,webform.class);
      startActivity(in);
  
  }
  public class MyData extends AsyncTask&lt;String,String,String&gt;
  {
      @Override
      protected void onPreExecute() {
          super.onPreExecute();
      }
  
      @Override
      protected void onPostExecute(String s) {
          super.onPostExecute(s);
          CustomAdapter cad = new CustomAdapter(MainActivity.this, s1, img);
          lv.setAdapter(cad);
      }
  
      @Override
      protected String doInBackground(String... params) {
          getData();
          return null;
      }
  }
  
  public void getData()
  {
      try {
          HttpClient httpClient=new DefaultHttpClient();
  
          HttpPost httpPost=new HttpPost("http://10.0.2.2/abcd.php");
          HttpResponse response=httpClient.execute(httpPost);
          HttpEntity httpEntity=response.getEntity();
          InputStream is=httpEntity.getContent();
          BufferedReader reader=new BufferedReader(new InputStreamReader(is,"utf-8"),8);
          StringBuilder strbuilder=new StringBuilder();
          String line=null;
          while ((line=reader.readLine())!=null)
          {
              strbuilder.append(line);
          }
          is.close();
          mydata=strbuilder.toString();
          JSONArray obj=new JSONArray(mydata);
          for(int i=0;i&lt;obj.length();i++)
          {
  
              JSONObject obj1=obj.getJSONObject(i);
              a.add(i,obj1.getString("Name"));
          }
          String[] s = new String[a.size()];
          s=a.toArray(s);
          s1 = s;
      }
      catch (Exception e)
      {
  
      }
  
  
  }
  
  
  }
  </code></pre>
  
  <p>Here is second activity listclick.java</p>
  
  <pre><code>public class listclick extends ActionBarActivity {
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_listclick);
      Intent in=getIntent();
      String s1=in.getStringExtra("position");
     }
  }
  </code></pre>
  
  <p>Here is Customlist.xml (layout file)</p>
  
  <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
  
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:background="#FF9200"
  android:clickable="true"&gt;
  &lt;TableRow&gt;
      &lt;ImageView
          android:layout_width="70dp"
          android:layout_height="70dp"
          android:background="@drawable/sf"
  
          android:id="@+id/imageview"
          /&gt;
      &lt;TextView
          android:layout_height="70dp"
          android:layout_width="fill_parent"
          android:textSize="20dp"
          android:fitsSystemWindows="true"
          android:textStyle="bold"
  
          android:layout_gravity="center"
          android:gravity="center"
          android:paddingLeft="20dp"
          android:text="Codewars 3.0"
          android:id="@+id/textView"
          /&gt;
  &lt;/TableRow&gt;
  &lt;/TableLayout&gt;
  </code></pre>
  
  <p>Here is CustomAdapter.java</p>
  
  <pre><code>public class CustomAdapter extends ArrayAdapter&lt;String&gt;{
  
  Context c1;
  String s1[];
  int s2[];
  CustomAdapter(Context c,String s[],int s3[])
  {
      super(c,R.layout.listcustom,s);
      this.c1=c;
      this.s1=s;
      this.s2=s3;
  }
  
  
  @Override
  public View getView(int position, View v, ViewGroup parent) {
      LayoutInflater li=(LayoutInflater) c1.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      v=li.inflate(R.layout.listcustom,null);
      TextView tv=(TextView)v.findViewById(R.id.textView);
      tv.setText(s1[position]);
  
  
  
  
  
  
      return v;
  }
  
  }
  </code></pre>