How to get selected item name form Context menu in android
<p>I am using the android List View in my activity ...</p>

<p>Now i need get the name for the item selected from the list... </p>

<p>here's my code for menu create</p>

<pre><code>public void onCreateContextMenu(ContextMenu menu, View v,ContextMenuInfo menuInfo) {
       super.onCreateContextMenu(menu, v, menuInfo);         


     MenuInflater inflater = getMenuInflater();
     inflater.inflate(R.menu.activity_main, menu); //select layout which should pop up in context menu

     menu.add("Delete");
     menu.add("Rename");

}
</code></pre>

<p>what i need is the way to get the list view selected item's name in the following function which captures the click on Context menu.</p>

<pre><code>@Override
public boolean onContextItemSelected(MenuItem item) 
{

     super.onContextItemSelected(item);


    if(item.getTitle()=="Delete"){
       //slected item's name in string varible here??
    }
    if(item.getTitle()=="Rename"){
            //slected item's name in string varible here??
    }
    return true;

}
</code></pre>
