0 Replies Latest reply on Aug 18, 2017 4:54 AM by eliartist

    Disable ContextMenu in Android


      I am trying to disable the contextmenu in my cordova-plugin for quite a while now, but didn't even get a good approach to solving the problem.


      I think I have to override the "onCreateContextMenu" method from the activity when initializing my cordova-plugin somehow. But I don't know exactly how to override it properly.


      public class ContextMenuPlugin extends CordovaPlugin {



           public void initialize(CordovaInterface cordova, CordovaWebView webView) {


                //when overriding the onCreateContextMenuListener in View I gets executed, but nothing happens (maybe it's the wrong View?)

                webView.getView().setOnCreateContextMenuListener(new View.OnCreateContextMenuListener() {



                     public void onCreateContextMenu (ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {

                          //when logging something in here it is written when the context menu is created

                          //but i cannot seem to be able to modify the menu variable




                super.initialize(cordova, webView);




      If this view is the wrong view, maybe I have to override the CordovaWebView in order to modify the activity that is referenced in webView to override the "onCreateActionMode" method in Activity. But CordovaWebView is an Interface and no class and I don't want to implement the whole Interface and I don't really believe this is necessary.


      If anyone has any ideas on this, please let me know.


      Edited to get into detail a bit more