Possible Duplicate:
How to Get Row values in Context menu using cursor?
I have created a ContextMenu and used the following code:
public boolean onContextItemSelected(MenuItem item){
switch(item.getItemId())
{
case R.id.Show_Note:
//AdapterView.AdapterContextMenuInfo info= (AdapterView.AdapterContextMenuInfo)item.getMenuInfo();
Intent i=new Intent(this, ShowNote.class);
Cursor c = (Cursor) getListView().getItemAtPosition(position);
int item_id = c.getInt(0);
i.putExtra("item_id", item_id );
startActivity(i);
break
It returns first row value every time, by pressing any list item. Please suggest, How to get pressed row value.
I think you have to move your Cursor at the specified position. Before getting data from it.
Add this line in your code and let me know what happen..
Your code something like: