1 private WebView webView;
2
3
4 @Override
5 protected void onCreate(Bundle savedInstanceState) {
6 super.onCreate(savedInstanceState);
7 setContentView(R.layout.activity_main);
8
9 webView = (WebView) findViewById(R.id.webview);
10 webView.setWebViewClient(new WebViewClient());
11 webView.loadUrl("https://www.javatpoint.com/java-tutorial");
12
13 WebSettings webSettings = webView.getSettings();
14 webSettings.setJavaScriptEnabled(true);
15
16 }
17 @Override
18 public void onBackPressed() {
19 if (webView.canGoBack()) {
20 webView.goBack();
21 } else {
22 super.onBackPressed();
23 }
24 }