I’ve already set up the contextmenu code on my ListView, and also i have already done the adaptercontextinfo to get the position from where i longpressed the item from listview, so my problem is how to access the members or views in that item using the adaptercontextinfo
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
MenuItem edit = menu.add("Edit");
MenuItem delete = menu.add("Delete");
edit.setOnMenuItemClickListener(new OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
Toast toast = Toast.makeText(PatientActivity.this, Long.toString(info.id), Toast.LENGTH_LONG);
toast.show();
return true;
}
});
}
so my question is how do i access the views in that item that i long clicked..

I wanted to access that small numbers above the name on that picture.. i have already determined the position from where i long clicked it.. but i don’t know how to access what i clicked
If you want to access the row’s layout from an AdapterContextMenuInfo use:
info.targetView. You can use this and findViewById() to fetch the number in the upper-left of your layout.I don’t know what you mean by members in your question, but if the number you want is an id like a primary key in a SQLiteDatabase you can simply use:
info.id.Also consider using the onContextItemSelected() method with is available in Activities and Fragments, instead of writing individual onMenuItemClickListeners. (It’s less work than creating listener after listener.)