-1

I have a function drawImage(json, check) in file test.js. ow I want to call this function from android code. I use cwv.loadUrl("javascript:test.drawImage("+jsonArray+","+ true+")");, but this solution doesn't work. How can I call this method from android code?

edi233
  • 3,511
  • 13
  • 56
  • 97

1 Answers1

1

You can put you JS function not in external file. Insted of it put it in your html file like this:

<script>
    function drawImage ()
    {
         // your computataion 
    }
</script>
// or connect your js functions from external file 
<script src="test.js"></script>

And then call it from code

cwv.loadUrl("javascript:drawImage('"+jsonArray+"','"+ true+"')");

And pay attention to single quotation!

And the second mothod was described by Mocialov Boris.

Sergey Brazhnik
  • 661
  • 4
  • 13