Any way to communicate with WebView in Android?

16,495

Solution 1

Check out addJavascriptInterface.

Solution 2

Here is a good example how to call javascript running inside the WebView:

http://android-er.blogspot.com/2011/10/call-javascript-inside-webview-from.html

Share:
16,495

Related videos on Youtube

znarf
Author by

znarf

“The gap between theory and practice is not as wide in theory as it is in practice.” – Author Unknown

Updated on June 18, 2022

Comments

  • znarf
    znarf almost 2 years

    Is it possible to interact with a webview in android trough my native android code?

    I develop can bus driver for android and I like to send my can bus data to a html 5 app in a webview without sending them over internet to a webservice. or is it possible to call funktions via the html 5 app in my native android app?

    Do you know a good solution for that scenario?

  • znarf
    znarf over 12 years
    thank you :) this is really nice!! i'm really happy there is a way for that :)