Imagine an HTML template that looks like this:
<html>
<head>
<style type="text/css">
body {
color: white;
}
</style>
</head>
<body>
The changes include:
<br/><br/>
%1$s
<br/><br/>
Would you like to update now?
</body>
</html>
I know I can load the contents into a WebView with webView.loadUrl("file:///android_asset/html/upgrade.html")
. But I also want to replace the $1 at runtime, just as if I were loading it from an XML file using String.format()
.
Is it possible to load the file contents into a String first so I can run String.format()
on it and then use webView.loadData()
instead?