I know I need to find a row in a context menu when long clicking by doing this:
AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
int position = info.position;
in onCreateContextMenu
How I can I implement it here? I seem to be only grabbing the FIRST two in this setup.
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.comments_context, menu);
menu.setHeaderTitle("Available Actions");
MenuItem Edit = menu.findItem(R.id.editComment);
MenuItem Delete = menu.findItem(R.id.deleteComment);
ReviewUser = ((TextView) v
.findViewById(R.id.labelReviewCommentUser)).getText()
.toString();
ReviewComment = ((TextView) v
.findViewById(R.id.labelReviewComment)).getText()
.toString();
}
I want ReviewUser and ReviewComment to be selected based on the list row the user clicks.
The
vrepresents theViewfor which the context menu is built, in this case theListViewand not the row view on which you acted. You probably want something like this: