JavaScript E/Web Console(8272): Uncaught ReferenceError: functionName is not defined:1 while loading webviews in a View Pager

try something like this and make changes as per your requirement

webview code

    web.getSettings().setJavaScriptEnabled(true);
    JavaScriptInterface JSInterface = new JavaScriptInterface(this);
    web.addJavascriptInterface(JSInterface, "JSInterface"); 
    setContentView(web);
    web.loadUrl("file:///android_asset/demo.html");

javascript interface

public class JavaScriptInterface {
        Context mContext;

        /** Instantiate the interface and set the context */
        JavaScriptInterface(Context c) {
            mContext = c;
        }

        public void showToast()
        {
            Toast.makeText(mContext, "Button Clicked", Toast.LENGTH_SHORT).show();
        }
    }

webpage code

<!DOCTYPE html>
<html>
  <head>
   <script>
     var i=0;
     function myFunction()
     {

       JSInterface.showToast();
     }
   </script>
 </head>

 <body>

    <button onclick="myFunction()">Try it</button>

    <p>By clicking the button above, a function will be called. The function will alert a message.</p>

 </body>
</html>

EDIT

function myFunction()
 {

   do here somthing
 }
Answer:1

I have a form that accepts name, phone no. Currently, I have done validation for non empty fields. I want to add validation for name (alphabets) and phone no.(numbers). My current code is given ...

I have a form that accepts name, phone no. Currently, I have done validation for non empty fields. I want to add validation for name (alphabets) and phone no.(numbers). My current code is given ...

  1. javascript check empty number

I have the following JS code: var b=0; function Fetch_Comments() { var comment=document.getElementsByClassName("comnt_list"); for (i=0; i<comment.length; i++) { var ...

I have the following JS code: var b=0; function Fetch_Comments() { var comment=document.getElementsByClassName("comnt_list"); for (i=0; i<comment.length; i++) { var ...

The reply at MVC3 Pass Model view to controller using javascript implies that this was impossible, at least for MVC 3. I was wondering if there is any way in MVC 4 to quickly pass the entire form ...

The reply at MVC3 Pass Model view to controller using javascript implies that this was impossible, at least for MVC 3. I was wondering if there is any way in MVC 4 to quickly pass the entire form ...

I'm looking to move a div "#menu" to the side when it's clicked on. I'm using this code <script> $("#menu").click(function(){ $("this").animate({ marginLeft: "+=...

I'm looking to move a div "#menu" to the side when it's clicked on. I'm using this code <script> $("#menu").click(function(){ $("this").animate({ marginLeft: "+=...

  1. moving animations
  2. moving animations for powerpoint free download
  3. moving animations for powerpoint
  4. moving animation css
  5. moving animation images
  6. moving animation wallpaper
  7. moving animation pictures
  8. moving animations gif
  9. moving animation app
  10. moving animations for powerpoint free
  11. moving animation wallpaper for desktop
  12. moving animation background
  13. moving animation css codepen
  14. moving animation android
  15. moving animation in ppt
  16. moving animation sketchup
  17. moving animation maker
  18. moving animation photoshop
  19. moving animation software
  20. moving animations on instagram