I want execute a jquery on webview.I fill webview with a html file. and wrote in oncreate method this codes :
WebView wv=new WebView(this);
setContentView(wv);
WebSettings webViewSettings = wv.getSettings();
webViewSettings.setJavaScriptEnabled(true);
webViewSettings.setDomStorageEnabled(true);
wv.loadUrl("file:///android_asset/index.html");
wv.loadUrl("javascript:fill()");
and add to oncreate method this attribute : @SuppressLint("SetJavaScriptEnabled")
My html file :
<html>
<head>
<title></title>
<script src="jquery.min.js"></script>
<script >
function fill(){
$('#input1').val('123');
}
</script>
</head>
<body>
<input type="text" id="input1"/>
</body>
</html>
I test my jquery code in chrome and worked . but when run app don't worked. Please advice