title: webView scrollTo not working all the time
body: <p>I am currently having a problem with Android webview scrollTo function. I have it working properly (sometimes), but as I am clicking on the links in webview, it sometimes resets the screen back to 0,0 position.</p>
  
  <p>Heres my code.</p>
  
  <pre><code>        public void onPageFinished(WebView webview, String Url) {
              final WebView newView = webview;
  
              if (ScrollX &gt; 0) { // &lt;-- int variable containing users Scroll position
                  newView.postDelayed(new Runnable() {
                      public void run() {
                          if (view.getScrollX() &gt; 0) {
             // ScrollX and ScrollY sometimes get reset before scrollTo happens, Why?
                              newView.scrollTo(ScrollX, ScrollY);
                              pageloaded = true; 
                          } else {
                              newView.scrollTo(ScrollX, ScrollY);
                              newView.post(this);
                          }
                      }
                  }, 10);
              }
          }
  </code></pre>
  
  <p>So here is whats going on. On my webviews onPageFinished, I am changing my webviews scroll position from the default 0,0 to whatever the user has their scroll position set to. I use the webviews postDelayed to delay things until the webview is completely loaded. Every 10ms my postDelayed checks to see if the webviews getScrollX() returns something > 0 (meaning webview has loaded). If it does, it goes into changing the webview scroll position section of the code and just finalizes that the webview has been loaded. If it doesn't, the code gets re ran after attempting to set the webviews scroll position. That way the next go around, my if statement can evaluate to true and avoid the rerun part of the code.</p>
  
  <p>Now here is the problem, when I use view.getScrollX() > 0 to determine if webview has been loaded, it works fine. But sometimes, view.getScrollX() > 0 will evaluate to true. But when I use the webview scrollTo function, either my ScrollX and ScrollY variables are getting reset before scrollTo, or during scrollTo use and the webview just goes back to 0,0. Whats going on here?</p>