Skip to content

Instantly share code, notes, and snippets.

@joshdholtz
Created June 21, 2012 00:16
Show Gist options
  • Save joshdholtz/2963092 to your computer and use it in GitHub Desktop.
Save joshdholtz/2963092 to your computer and use it in GitHub Desktop.
WebView Setup
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_webview);
webview = (WebView)this.findViewById(R.id.activity_webview_webview);
// Enables javascript
WebSettings webSettings = webview.getSettings();
webSettings.setJavaScriptEnabled(true);
// Makes links clicked in the webview open in this same webview (instead of default browser)
webview.setWebViewClient(new WebViewClient() {
});
String url = this.getIntent().getStringExtra("url");
if (url != null) {
webview.loadUrl(url);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment