title: Get listview item position on button click
body: <p>This is my listview click event:</p>
  
  <pre><code> lv1.setOnItemClickListener(new OnItemClickListener() {
         @Override
              public void onItemClick(AdapterView&lt;?&gt; a, View v, int position, long id) { 
                  Object o = lv1.getItemAtPosition(position);
                  ItemDetails obj_itemDetails = (ItemDetails)o;
                  Toast.makeText(ListViewImagesActivity.this, "You have chosen : " + " " + obj_itemDetails.getName(), Toast.LENGTH_LONG).show();
  
          }  
   });
  </code></pre>
  
  <p>And this is my button click event:</p>
  
  <pre><code>btnNxt = (Button) findViewById(R.id.btnNext);
   btnNxt.setOnClickListener(new OnClickListener() {
   @Override
   public void onClick(View arg0) {
    //Here I need to get that position
  });
  </code></pre>
  
  <p>Now I need to get the position of the clicked listview item..I have declared postion globally but that always gives me position 1.</p>
  
  <p>Can anyone say me how do I get the positon ?</p>