1 Reply Latest reply on Oct 7, 2016 7:47 AM by kerrishotts

    Tutorial is broken "Embedding the webview - Android"


      For anyone that is following this tutorial and notices that the 'Add Item' button does not work - it's because the button click handler (javascript) is incorrect.


      In the example i followed (@ Oct 2016) it tells to paste this script to handle the click of the button:


      addItem: function() {

           console.log("Plugin ADD ITEM CALLED " + HybridBridge);

           var item = document.getElementById("bookmark").value;

           HybridBridge.addItem(item,function(){console.log("Hybrid Bridge Success")},function(e){console.log("Hybrid Bridge Error" + e)});



      Notice there are 3 arguments passed to HybridBridge.addItem().

      1. a value from the text box

      2. a success callback function

      3. a fail callback function.


      If you examine the Java handler (the 'execute' method within package 'org.sample.hybrid' - a file named HybridBridge.java)

      With the following Java:

      String className = args.getString(1);

      It's trying to extract a class name from the this list of arguments too, which isn't there (item 1, 2 or 3 above...) The result is an error triggering the 'catch' script block.


      fix this by adding the classname to your list of arguments like so...

      HybridBridge.addItem(item,"org.sample.hybridandroidapp.MyListActivity",function(){console.log("Hybrid Bridge Success")},function(e){console.log("Hybrid Bridge Error" + e)});


      Adobe (phoneGap), can we get this tutorial fixed? its disheartening falling at the first hurdle...