I am trying to display HTML content in a web view. The UI is simple jQuery Mobile. The HTML displays, but the CSS and JavaScript from the assets folder.
Css and js file will resides in assets folder.
Note : Put you .css and .js file in assets folder as well
here is the implementation code
OUTPUT :
You may like Web View with Progress Dialog visit
Css and js file will resides in assets folder.
Note : Put you .css and .js file in assets folder as well
here is the implementation code
OUTPUT :
WebView wvSpecification= (WebView)rootview.findViewById(R.id.wvSpecification);
StringBuilder
sb = new StringBuilder();
sb.append("<HTML
xmlns='http://www.w3.org/1999/xhtml'>" +
"<HEAD>"+
"<meta
name='viewport' content='width=device-width, initial-scale=1'>"+
"<link
rel='stylesheet' href=cssfilename.css'/>"+
"<link
rel='stylesheet' href= cssfilename.css'/>"+
"<script
src= jsfilename.js' type='text/javascript'></script>"+
"</HEAD>");
sb.append("<body>"+
"<h1>Mobile</h1>"+
"<table
class='responsive'>"+
"<tr>"+
"<th>Company
Name</th>"+
"<th>Model
Name</th>"+
"<th>Version</th>"+
"</tr>"+
"<tr>"+
"<td>Google</td>"+
"<td>Nexus
5</td>"+
"<td>4.4</td>"+
"</tr>"+
"<tr>"+
"<td>HTC</td>"+
"<td>Desire
X</td>"+
"<td>4.1</td>"+
"</tr>"+
"<tr>"+
"<td>Samsung</td>"+
"<td>Galaxy
s4</td>"+
"<td>4.3</td>"+
"</tr>"+
"</table>"+
"</body>");
sb.append("</HTML>");
wvSpecification.loadDataWithBaseURL("file:///android_asset/",sb.toString(),"text/html","UTF-8",null);
I will be happy if you will provide your feedback or follow this blog. Any suggestion and help will be appreciated.
Thank you :)