title: How to get data from listview to context menu?
body: <p>actually i got a problem while creating my project. I am having one list view in one screen where data comes from database &amp; binds to it. I created one context menu here with two menus (view &amp; delete). The problem i am facing is when i make a long click context menu occur &amp; when i click on anyone of the menu it navigates to another screen. here i want the listview(which was clicked) item data to pass to next screen. By i am not getting it. This is the following code...</p>
  
  <p>Main.java</p>
  
  <pre><code>     /*******some code****/
  
      DbHandler dbh=new DbHandler(GroupName.this);
      ast=dbh.selectgroupnam(s); 
         //here "ast" is of ArrayList defined globally        
      ArrayAdapter&lt;String&gt; adp=new ArrayAdapter&lt;String&gt;(this,android.R.layout.simple_list_item_1,ast);
      lv.setAdapter(adp);
      registerForContextMenu(lv); 
  
      lv.setOnItemClickListener(new OnItemClickListener(){
      @Override
      public void onItemClick(AdapterView&lt;?&gt; arg0, View v, int p, long arg3) {
      // TODO Auto-generated method stub  
       TextView tv=(TextView)v;
       String gnam=tv.getText().toString();
  
  }});
  
    }//on create
  
     //context menu code
  
     @Override
     public void onCreateContextMenu(ContextMenu menu, View v,
          ContextMenuInfo menuInfo) {
      // TODO Auto-generated method stub
      super.onCreateContextMenu(menu, v, menuInfo);
          menu.add(0, v.getId(), 0, "View");  
          menu.add(0, v.getId(), 0, "Delete");    
  }
  
  @Override
  public boolean onContextItemSelected(MenuItem item) {
      // TODO Auto-generated method stub
      Toast.makeText(getApplicationContext(), "group name" + gnam,30).show();
      if (item.getTitle() == "Delete") {
          Toast.makeText(getApplicationContext(), "selected group" + gnam, 30).show();
      startActivity(new Intent(GroupName.this,GroupEdit.class));
      }
      else 
      {
      startActivity(new Intent(GroupName.this,GroupEdit.class));
      }
      return super.onContextItemSelected(item);
  }
  </code></pre>
  
  <p>As per the following code how to get the list view data (which was long clicked for context menu) &amp; pass the data to GroupEdit.class. </p>
  
  <p>Waiting for reply......</p>