title: How to get listview position?
body: <p>I have problem in Listview onListItemClick() method. I am not getting the position of the list.
  Here is my code Pls help me </p>
  
  <p><strong>coverletterselection.xml</strong></p>
  
  <pre><code>    &lt;RelativeLayout 
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"&gt; 
      &lt;ImageView 
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:src="@drawable/bgg"     /&gt;
      &lt;LinearLayout
          xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="fill_parent"
          android:orientation="vertical"          
          android:layout_height="wrap_content"&gt;
          &lt;ImageView
              android:layout_width="fill_parent"              
              android:background="@drawable/blackstrip"
              android:layout_height="wrap_content" /&gt;             
          &lt;ImageView
              android:layout_width="fill_parent"  
              android:id="@+id/coverletterbgView"
              android:background="@drawable/imgselectcoverltrresume"
              android:layout_height="wrap_content" /&gt;
          &lt;ListView 
              android:id="@+id/list" 
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"    /&gt;          
      &lt;/LinearLayout&gt;
      &lt;RelativeLayout
          xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="fill_parent"      
          android:layout_height="wrap_content"&gt;
          &lt;ImageButton
              android:layout_width="wrap_content"     
              android:layout_marginLeft="5sp"     
              android:background="@drawable/submission"
              android:layout_height="wrap_content" /&gt; 
          &lt;ImageButton
              android:layout_width="wrap_content"             
              android:background="@drawable/iconaddplus"
              android:layout_height="wrap_content" 
              android:layout_alignParentRight="true" 
              android:layout_marginRight="10sp"/&gt;         
      &lt;/RelativeLayout&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p><strong>Java File</strong></p>
  
  <pre><code> public class MainActivity extends ListActivity implements OnItemClickListener
  {       
      int ht,wt;
  ListView list;
      DataHelperCoverLetter dbcl;
      ArrayList&lt;String&gt; coverLetterTitle = new ArrayList&lt;String&gt;();
  
      @Override
      protected void onCreate(Bundle savedInstanceState)
      {   
          super.onCreate(savedInstanceState);
          setContentView(R.layout.coverletterselection);      
  
          dbcl = new DataHelperCoverLetter(this);
          DisplayMetrics displaymetrics = new DisplayMetrics();       
          getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);      
          ht = displaymetrics.heightPixels;      
          wt = displaymetrics.widthPixels;
          bg = (ImageView)findViewById(R.id.coverletterbgView);
          bg.setLayoutParams(new LinearLayout.LayoutParams(wt, ht/3));    
  
          coverLetterTitle = dbcl.fetchCoverLetter();
  
              //get the listView from your layout and define the listener on it
              list = (ListView)findViewById(R.id.list);
              list.setOnItemClickListener(this);
  
          addCoverLetterBtn = (ImageButton)findViewById(R.id.addCoverLetter);
          addCoverLetterBtn.setOnClickListener(this);
          setListAdapter(new CoverLetterAdaptor(this,ht,wt,coverLetterTitle));        
      }
      @Override
      public void onListItemClick(ListView parent, View view, int position, long id)
      {     
          Log.i("OnClick", "position = "+position);
  
      }   
  }
  
  
  public class CoverLetterAdaptor extends BaseAdapter
  {
      private LayoutInflater mInflater;   
      ArrayList&lt;String&gt; coverLetterItems;
      Context context;    
      int ht,wt;  
  
      public CoverLetterAdaptor(Context context,int ht,int wt,ArrayList&lt;String&gt; coverLetterItems)
      {
          this.context = context;
          this.coverLetterItems = new ArrayList&lt;String&gt;();
          this.coverLetterItems = coverLetterItems ;          
          this.ht = ht;
          this.wt = wt;
          mInflater = LayoutInflater.from(context);   
      }
  
      public int getCount() {
          return coverLetterItems.size();
      }
  
      public Object getItem(int position) {
          return position;
      }
  
      public long getItemId(int position) {
          return position;
      }
  
  
      public View getView(int position, View convertView, ViewGroup parent)
      {       
          ViewHolder holder;
  
          convertView = mInflater.inflate(R.layout.coverletteradaptor, null);     
          holder = new ViewHolder();
  
          holder.coverLetterTxt = (TextView) convertView.findViewById(R.id.coverLetterAdaptorTxt);
          holder.bgImageCCAdaptor = (ImageView)convertView.findViewById(R.id.bgimageCoverLetter);
          holder.bgImageCCAdaptor.setLayoutParams(new RelativeLayout.LayoutParams(wt, ht/7));     
  
          convertView.setTag(holder);
          holder = (ViewHolder) convertView.getTag();
          holder.coverLetterTxt.setText(coverLetterItems.get(position));                          
          return convertView;
      }
  
      static class ViewHolder 
      {
          TextView coverLetterTxt;        
          ImageView bgImageCCAdaptor;
      }
  }
  </code></pre>