title: How to get position of item clicked on listview?
body: <p>my activity code to get position of item on ListActivity to update status checked to database </p>
  
  <pre><code>public class ViewList extends ListActivity {
  private ListViewAdapter lAdapter;   
  DBAdapter db;
  @Override
  public void onCreate(Bundle savedInstanceState){
      super.onCreate(savedInstanceState);
  
      db = new DBAdapter(this);
      db.open();      
      Cursor cursor = db.fetchAllDeliveryItem();
      lAdapter = new ListViewAdapter(getApplicationContext(),cursor);     
      //Toast.makeText(getApplicationContext(), cursor.getString(1), Toast.LENGTH_SHORT).show();
      setListAdapter(lAdapter);
  
  }
  private class ListViewAdapter extends CursorAdapter{
  
  
  @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          // TODO Auto-generated method stub
  
          return super.getView(position, convertView, parent);
      }
  
  public ListViewAdapter(Context context, Cursor c) {
      super(context, c);
      // TODO Auto-generated constructor stub
  }
  
  
  
  
  @Override
  public void bindView(View view, Context context, Cursor cursor) {
      TextView tvListText = (TextView)view.findViewById(R.id.label);
      CheckBox cbListCheck = (CheckBox)view.findViewById(R.id.check);
  
      tvListText.setText(cursor.getString(cursor.getColumnIndex("itemname")));
      **cbListCheck.setChecked((cursor.getInt(cursor.getColumnIndex("delivered"))==0? false:true));
      cbListCheck.setOnCheckedChangeListener(new OnCheckedChangeListener() {
  
          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
               db.updateItem(position);**
  
  
          }
      });
  
  }
  
  @Override
  public View newView(Context context, Cursor cursor, ViewGroup parent) {
      LayoutInflater li = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      return li.inflate(R.layout.receiverow, parent, false);
  }
  </code></pre>