title: Getting the item selected in list view using Context Menu
body: <p>Cant figure out what is wrong with my code:</p>
  
  <pre><code>registerForContextMenu(lv_myhitshotlists);
      AdapterContextMenuInfo menuinfo = null;
  
      @Override
      public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
          super.onCreateContextMenu(menu, v, menuInfo);
          /*menu.setHeaderTitle("Item Operations");
          menu.add(0, v.getId(), 0, "Edit Film");
          menu.add(0, v.getId(), 0, "Delete Film");*/
  
          MenuInflater inflater = getMenuInflater();  
          inflater.inflate(R.menu.context_myfilm_list,menu);
          menuinfo = (AdapterContextMenuInfo) menuInfo;
          menu.setHeaderTitle("Options");
      }
  
      @Override
      public boolean onContextItemSelected(MenuItem item) {
      try{
          menuinfo = (AdapterContextMenuInfo) item.getMenuInfo();
          AdapterView.AdapterContextMenuInfo info= (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
          Long ids = madapter.getItemId(info.position);//what item was selected is ListView
           i = ids.intValue();
  
          switch (item.getItemId()) { 
  
          case R.id.menu_edit_myfilm:
  
              intHitshotEdit = new Intent(MyHitshotListActivity.this,MyHitshotInfoEditActivity.class);
              intHitshotEdit.putExtra("video_id", myList.get(i).getid());
              intHitshotEdit.putExtra("video_title", myList.get(i).getTitle());
              Toast.makeText(getApplicationContext(),myList.get(i).getTitle(), Toast.LENGTH_SHORT).show();
              //intVideodetails.putExtra("video_desc", myList.get(i).get);
              startActivity(intHitshotEdit);
              overridePendingTransition(R.anim.slideinfromright,R.anim.slideouttoleft);
              //intVideoUpload.putExtra("title",""+info.);
  
              return true;
  
          case R.id.menu_delete_myfilm:
  
              return true;
  
          default:
  
          }
      }catch(Exception e)
      {
          e.printStackTrace();
      }
          return super.onContextItemSelected(item);
          }
  </code></pre>
  
  <p>Each and every time <code>Long ids</code> is returning 0.I am binding data to listview in the onpostexecute() part of asynctask like this:</p>
  
  <pre><code> public void setAdapterToListview(ArrayList&lt;MyHitshotListData&gt; myList) {
                madapter=new MyHitshotListAdapter(context, myList);
                lv_myhitshotlists.setAdapter(madapter);
            }
  </code></pre>
  
  <p>MyHitshotListAdapter is an adapter extending base adapter class.What is wrong??Why the value of ids is always zero??The value of <code>position</code> is coming right.</p>