Is it possible to pass a value to the URL mentioned in webView.loadUrl? something like this??
webView.loadUrl(\"file:///android_asset/www/index.html#value=\"
I found the solution.. posting it here for the sake of others :)
I added the following snippet of code in my Activity class which solved the problem,
webView.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url)
{
webView.loadUrl("javascript:callMe(\""+data_val+"\")");
}
});
Thanks all :)
I found a simple solution. Below is the code which is working
String s = "http://10.0.2.2/myhtml/add.php?bc=" + bc;
myWebView.loadUrl(s);
You'll want to use a GET-Query string to do so. Note that the maximum length of a URL is 256 chars!
After you supplied your arguments that way, you can use JavaScript to read them (by cutting them out of the URL). Here is a Code-Snipped and an article on this topic.