1

Android custom context menu without a View

view story
linux-howto

http://stackoverflow.com – I'm doing some work with OSM maps and its MapView supports an OnItemGestureListener for single and long presses for items placed on the MapView. I'm trying to come up with a way to display a context menu for an item when long pressed (e.g. a list of commands). I can't use the usual Activity onCreateContextMenu approach because I don't have a View to registerForContextMenu() with. If I register the MapView, I'll get the context menu popping up whenever I hold the MapView for a second, even when panning. So I'm thinking I have to either use the MenuInflater with a ContextMenu or just Menu objec (HowTos)