1. CSS: Applying CSS is just the same as you would do with normal HTML pages. The sample_page.html in the assets folder refers to the sample_style.css file in the same folder. One thing you might notice is how we get the rounder corners for the divs. This CSS attribute does the trick.
3. All together: In the sample_page.html I have a header, a body and the controls. The controls have four buttons
c. Exit: This button basically closes/exits the app, by calling the JSInterface.java method which is bound to the HomeActivity.java via OnExitAppListener.java
d. Alert: This shows an alert which is basically an AlertDialog in Android.
// Before using the above code, you have to inject the interface object which
// has a name “jsinterface”
public boolean onJsAlert(WebView view, String url, String message, JsResult result)
url = “Sample App Alert”;
return super.onJsAlert(view, url, message, result);
You can checkout the whole source code here. It’s ready to run. Let me know if you have any issues.