Issue
I am implementing a timer on webview activity with 1 second delay like clock. On each event webview is loaded with generated HTML having canvas and 2 tables. With each tick, webview regenerate html and display content. As soon as I start scroll to go down, it starts scrolling auto and behaves erratically and moves up and down. Thanks in advance for your help
Solution
Thanks for your knowledge sharing. This issue was solved after 5 days by following countermeasures:
Splitting html into different divs and script tags.
Replacing full html mWebView.loadDataWithBaseURL with
String updateScript += "var mydiv=document.getElementById('div1');"; updateScript += "var oldScript=document.getElementsByTagName('script')[0];"; updateScript += "var newScript = document.createElement('script');"; updateScript += "mydiv.innerHTML= textStr;"; updateScript += "newScript.innerHTML = scrStr;"; updateScript += "document.body.appendChild(newScript);"; updateScript += "oldScript.remove();";
mWebView.loadurl("javascript:" + updateScript); on handler event.
Thanks
Answered By - DK Manchanda
Answer Checked By - Robin (JavaFixing Admin)