Hello Android
✓ Published0🌍 Public
HHsuHsiaoHsuan
Last edited Dec 26, 2017
Created on Dec 26, 2017
This example demonstrates two-way communication between a web page and a native Android app. The HTML interface provides buttons that trigger JavaScript functions, which in turn call Java methods exposed through the `addJavascriptInterface` API. The Java `JsInterface` class handles these calls by showing toast notifications, opening alert dialogs, toggling toolbar visibility, and locking the back key. Conversely, a `calledFromAndroid` JavaScript function updates a paragraph’s text when invoked from the Android side. The code uses standard Android `AlertDialog`, `Toast`, and `WebView` APIs to bridge the web and native environments.
AI-generated description