Skip to content

Instantly share code, notes, and snippets.

@evilsocket
Created January 19, 2016 06:00
Show Gist options
  • Save evilsocket/4f4deb1dbd1d66519dba to your computer and use it in GitHub Desktop.
Save evilsocket/4f4deb1dbd1d66519dba to your computer and use it in GitHub Desktop.
public class WebViewGUI extends Activity {
WebView mWebView;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mWebView=new WebView(this);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.addJavascriptInterface(new JavaScriptInterface(), "jsinterface");
mWebView.loadUrl("file:///android_asset/www/index.html");
setContentView(mWebView);
}
final class JavaScriptInterface {
JavaScriptInterface () { }
public String getSomeString() {
return "string";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment