我在 string.xml 文件中有一个 url <a href 标签,它具有动态值。如何在 webview 中打开 url?
I have a url in string.xml file inside <a href tag which has dynamic values. how to open that url in webview?
<string name="xyz">This is my string with url <a href="example://xyz.com:api/deviceconfig/dynamicValue()/something?some_token=dynamic_vlaue& locale=en"></a></string>
动态值每次都会改变。如何制作正确的 url 并在 webview 中打开它
使用getString() of an Activity Context to Get String. And use that String in WebView's loadUrl()方法。
示例
String url = getString(R.id.url_in_string);
yourWebView.loadUrl(url);
<string name="xyz">This is my string with url <a href="example://xyz.com:api/deviceconfig/dynamicValue()/something?some_token=dynamic_vlaue& locale=en"></a></string>
动态值每次都会改变。如何制作正确的 url 并在 webview 中打开它
使用getString() of an Activity Context to Get String. And use that String in WebView's loadUrl()方法。
示例
String url = getString(R.id.url_in_string);
yourWebView.loadUrl(url);