I’m trying to set the URL for a WebView from the layout main.xml.
By code, it’s simple:
WebView webview = (WebView)findViewById(R.id.webview);
webview.getSettings().setJavaScriptEnabled(true);
webview.loadUrl("file:///android_asset/index.html");
Is there a simple way to put this logic into the layout XML file?
Since URL is basically a string, you can put it into values/strings.xml file
then you can use it like this: