Last active
October 3, 2015 10:31
-
-
Save hndr91/5521a54dbc5c051307be to your computer and use it in GitHub Desktop.
Simple Android WebView - onCreate
This file contains 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
//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