title: Android OnItemClickListener in list view not working
body: <p>I'm have made a tab activity which works fine when i click on specific tab i extend the list activity and am also getting the list view but i'm not able to make the items in list clickable. code:</p>
  
  <pre><code>package com.infra.android.views;
  
  import java.util.ArrayList;
  import java.util.HashMap;
  import org.w3c.dom.Document;
  import org.w3c.dom.Element;
  import org.w3c.dom.NodeList;
  import android.app.ListActivity;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.AdapterView;
  import android.widget.ListAdapter;
  import android.widget.ListView;
  import android.widget.SimpleAdapter;
  import android.widget.Toast;
  import android.widget.AdapterView.OnItemClickListener;
  
  public class TopNewsActivity extends ListActivity {
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.listplaceholder);
  
          ArrayList&lt;HashMap&lt;String, String&gt;&gt; mylist = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();
  
  
          String xml = XMLfunctions.getTopNewsXML();
          Document doc = XMLfunctions.XMLfromString(xml);
  
          int numResults = XMLfunctions.numResults(doc);
  
          if((numResults &lt;= 0)){
              Toast.makeText(TopNewsActivity.this, "No Result Found", Toast.LENGTH_LONG).show();  
              finish();
          }
  
          NodeList nodes = doc.getElementsByTagName("result");
  
          for (int i = 0; i &lt; nodes.getLength(); i++) {                           
              HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();    
  
              Element e = (Element)nodes.item(i);
              map.put("id", XMLfunctions.getValue(e, "id"));
              map.put("title", XMLfunctions.getValue(e, "title"));
              mylist.add(map);            
          }       
  
          ListAdapter adapter = new SimpleAdapter(this, mylist , R.layout.main, new String[] { "title"}, new int[] { R.id.item_title});
  
          setListAdapter(adapter);
  
          final ListView lv = getListView();
          lv.setTextFilterEnabled(true);  
          lv.setOnItemClickListener(new OnItemClickListener() {
              public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {              
                  @SuppressWarnings("unchecked")
                  HashMap&lt;String, String&gt; o = (HashMap&lt;String, String&gt;) lv.getItemAtPosition(position);                   
                  Toast.makeText(TopNewsActivity.this, "ID '" + o.get("id") + "' was clicked.", Toast.LENGTH_LONG).show(); 
  
              }
          });
      }
  }
  </code></pre>
  
  <p>when i click on the item it should probably give the id of the clicked item but it is not working.</p>