Tag Archives: JavaScript

Android JavaScript Interface

This tutorial will show you how to access native features from a WebView, and how to pass data back to a WebView from native code. The former part, invoking native code from a WebView, is achieved through adding a JavaScript interface and is documented in the Android API guide here. The example in the guide causes an Android Toast to be triggered from the WebView. All very well, but what about having an app or part of an app that runs in a WebView, gets data from the Android OS and, rather than simply calling a native function like Toast, returns the data to the WebView UI? Read full article