-2

Can anyone help me with the line that loads an URL directly in my web viewer? I have the viewer with no address bar and I want to display an external html from an URL. I would be very grateful!

  • You may want to share code of the efforts you've made already and the challenges you're having. – Mbuodile Obiosio Jul 14 '18 at 11:49
  • Can you please put some code you have already written. so it will be easier to solve your problem. – Raman Mishra Jul 14 '18 at 12:01
  • Don't forget to use `` This code is already on other posts: https://stackoverflow.com/questions/16207094/android-webview-not-loading-url or you can use something like abapks.com – Ute Hirsch Jul 15 '18 at 06:04

1 Answers1

0
WebView wv = (WebView)findViewById(R.id.website);
WebViewClient client = new WebViewClient();
wv.setWebViewClient(client);
wv.getSettings().setJavaScriptEnabled(true);
wv.loadUrl(url);
Raj
  • 2,997
  • 2
  • 12
  • 30
  • While this code may answer the question, providing additional context regarding why and/or how this code answers the question improves its long-term value. – jay.sf Jul 14 '18 at 12:35
  • Nonsense @jaySf. This was already good enough. Even overdone as only the loadUrl line would have provided all. – greenapps Jul 14 '18 at 13:06