title: How to set onItemselectlistener on Listview?
body: <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="fill_parent"
     android:layout_height="fill_parent" 
     android:orientation="vertical"&gt;
   &lt;LinearLayout android:id="@+id/LinearLayout1" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content"&gt;
      &lt;Button 
          android:text="AddCar" 
          android:id="@+id/btnaddcar" 
          android:textSize="20dp"
          android:layout_width="fill_parent" 
          android:layout_height="fill_parent"&gt;
      &lt;/Button&gt;   
  &lt;/LinearLayout&gt;
  &lt;ListView android:id="@id/android:list"
  
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  
  android:layout_weight="2"
  android:drawSelectorOnTop="false"&gt;
  &lt;/ListView&gt;
   &lt;/LinearLayout&gt;
  
  
   protected void onCreate(Bundle savedInstanceState) {
  
      super.onCreate(savedInstanceState);
      setContentView(LayoutInflater.from(getParent()).inflate(R.layout.carlist, null));
   //     setContentView(R.layout.carlist);
      db = new Database(getApplicationContext());
      db.open();
      //listview = (ListView) findViewById(R.id.list1);
      cararr=new String[db.getCountCar()];
      carimg=new String[db.getCountCar()];
      carimg=db.getImageList();
      cararr=db.getAllCarName();
  
  
  
      /*adapter=new LazyAdapter(this, db.getImageList(),db.getAllCarName());
  
      listview.setAdapter(adapter);*/
  
      cararr=db.getAllCarName();
       SimpleAdapter adapter = new SimpleAdapter(
                  this,
                  groupData,
                  R.layout.custom_row_view,
                  new String[] {"carname","image"},
                  new int[] {R.id.text1, R.id.image}
                  );
       populateList();
          setListAdapter(adapter);
      //listview.setOnItemClickListener(this);
  //  listview.setOnItemSelectedListener(this);
  
      db.close();
      btnaddcar = (Button)findViewById(R.id.btnaddcar);
      btnaddcar.setOnClickListener(this);
  }
  private void populateList() {
      // TODO Auto-generated method stub
  
      Map&lt;String, String&gt; group;
      db.open();
      cararr=new String[db.getCountCar()];
      carimg=new String[db.getCountCar()];
      carimg=db.getImageList();
      cararr=db.getAllCarName();
      for(int i=0;i&lt;db.getCountCar();i++)
      {
          group = new HashMap&lt;String, String&gt;();
          group.put("carname", cararr[i]);
          group.put("image",carimg[i]);
          groupData.add(group);
      }
      db.close();
  }
  </code></pre>
  
  <p>How to set onItemselectlistener on Listview?</p>