Created
January 19, 2016 06:00
-
-
Save evilsocket/4f4deb1dbd1d66519dba to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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