OnItemClickListener not Working?
<p>Why is my <code>OnItemClickListener</code> not working?</p>

<pre><code>public class UseAdp extends Activity {
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    Context context=this;

    ListView lv=(ListView)  findViewById(R.id.list_v);

    MyAdapter adp=new MyAdapter(context);

    for (int i = 0; i &lt; 50; i++) {
      adp.addItem("item " + i);
    }
    lv.setAdapter(adp);
    // lv.setItemsCanFocus(true);

    lv.setOnItemClickListener(new OnItemClickListener() {

      @Override
      public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2,
          long arg3) {
        // TODO Auto-generated method stub
        showToast(arg2);
      }
    });
    //registerForContextMenu(lv);      
  }

  public void showToast(int arg)
  {
    Toast.makeText(this, "Position"+arg, Toast.LENGTH_SHORT).show();
  }
}
</code></pre>

<p>Here is my adapter code:</p>

<pre><code>public class MyAdapter extends BaseAdapter {

  private Context mcontext;
  private ArrayList&lt;String&gt; aList=new ArrayList&lt;String&gt;();  

  public MyAdapter(Context context) { 
     mcontext = context;          
  } 

  @Override
  public int getCount() {
    // TODO Auto-generated method stub
    return aList.size();   
  }

  @Override
  public Object getItem(int position) {
    // TODO Auto-generated method stub
    return aList.get(position);
  }

  @Override
  public long getItemId(int position) {
    // TODO Auto-generated method stub
    return position;
  }

  public void addItem(final String item) {
    aList.add(item);
    //notifyDataSetChanged();
  }

  @Override
  public View getView(int position, View convertView, ViewGroup parent) {

     // TODO Auto-generated method stub
     LayoutInflater inflater = (LayoutInflater)mcontext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

     convertView=inflater.inflate(R.layout.list_rows,parent,false);


     ((TextView)convertView.findViewById(R.id.txt1)).setText(getItem(position).toString());
     ((ImageView)convertView.findViewById(R.id.img1)).setImageResource(R.drawable.icon);
     if(position==2){
     ((CheckBox)convertView.findViewById(R.id.CheckBox01)).setChecked(true);
     }
     return convertView;
  }
}
</code></pre>
