-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?

1

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

I must have this method in external file. Can you tell me how can I do that in that way?
I've edited my answer. Look above

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.