Android ContextMenu to change button text
Here's my problem:
I have a button in my android application that when I longClick it a context menu appears with a list of values that a user can choose from.
What I need to do is when the user chooses a value, I need the button's text to be that value. I can't figure out how to get the onContextItemSelected listener to remember which button triggered the context menu and then set it's text to the selected item.
Thanks for any help/tips you can giv开发者_运维问答e me.
Have you tried this?
Hmmmm, I believe you can do the following:
@Override
public boolean onContextItemSelected(MenuItem item) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
View longClickedView = info.targetView;
...
}
精彩评论