-1

I would like to do a program such that when there is a long-click on my listview, there will be a menu of options for users to choose. I have searched and found out that I can do what I want using context menu. However, the options after the long click are dependent on certain conditions such as the item clicked in the listview. Examples where I have gone through using context menu are standard menu which will appear regardless the items chosen from the listview. What should I do to solve this? Any help will be appreciated. Thanks

user3131408
  • 11
  • 1
  • 5

1 Answers1

0

As onCreateContextMenu receives a reference to the view, you could check the id/tag and open different context menus based on that information. You might want to use ints as tags, so you can just make a switch clause and handle the inflation inside it.

Daniel Bo
  • 2,518
  • 1
  • 18
  • 29