Skip to content

Instantly share code, notes, and snippets.

@hndr91
Last active October 3, 2015 10:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hndr91/5521a54dbc5c051307be to your computer and use it in GitHub Desktop.
Save hndr91/5521a54dbc5c051307be to your computer and use it in GitHub Desktop.
Simple Android WebView - onCreate
//Define URL
private static final String URL = "http://updatesepati.blogspot.com/";
//Define WebView
private WebView webView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
webView = (WebView)findViewById(R.id.webView); //get webView
webView.setWebViewClient(new WebViewClient()); //set webView client
WebSettings webSettings = webView.getSettings();// initiate webView settings
webSettings.setJavaScriptEnabled(true); //allow webView perform javascript
webSettings.setBuiltInZoomControls(true); //show zoom control
webView.loadUrl(URL); //load URL
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment