Context Menu on Android WebView

I'd like to add a context menu on an entire Android WebView. I have the following code:

public void onCreateContextMenu (ContextMenu menu, View v, ContextMenuInfo menuInfo) {
   super.onCreateContextMenu(menu, v, menuInfo);
   if (v.getId() == {       
       //display context menu

I noticed that the context menu is only displayed when a long press is done on a link in the webpage rendered by the WebView. When a long press is done in an empty area of the web view (an empty or text only area of the web page) the context menu is not displayed.

Any idea about how to display a context menu for the entire webpage and not only for links?


Take a look at onLongClick() and then implement on your dialog with a list.

Need Your Help

Set form MinWidth and MinHeight based on child property

wpf mvvm

I'm writing an application in WPF using the MVVM pattern. In my application I've got an IPopupWindowService which I use to create a popup dialog window.