Pass Data from Android Java to Webview - jQueryMobile -


i followed trick passing data html webview post how pass parameter html file android.

i have in java:

try {     string template = streamtostring(getassets().open("html/index.html"));     string data = template.replaceall("%parameter%", parameter);      webview.loaddatawithbaseurl("file:///android_asset/html/", data, "text/html", "utf-8", null); } catch (ioexception e) {     e.printstacktrace(); } 

in html, have string "%parameter%".

the solution works test device running android 2.3.6, didn't work in device running android 4.1.1. html have css , js files. problem related content of html page?

any better approach on i'm trying achieve? simple want send data java html webview.

this content of html:

<!doctype html> <html>  <head>      <title>like pub</title>      <meta name="viewport" content="width=device-width, initial-scale=1">      <link rel="stylesheet" href="jquery.mobile-1.2.0.min.css" />      <script type="text/javascript" src="jquery-1.7.2.min.js"></script>       <script type="text/javascript" src="jquery.mobile-1.2.0.min.js"></script>     <script type="text/javascript">          $('#index-page').live('pageshow', function(event, data){             //         });     </script>   </head>  <body>      <div data-role="page" id="index-page">         %website_url%     </div> </body> </html> 


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -