Created
June 21, 2012 00:16
-
-
Save joshdholtz/2963092 to your computer and use it in GitHub Desktop.
WebView Setup
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
@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