title: Reloading a WebView with a JavaScript call from a loaded web page
body: <p>I have a <code>WebView</code> in an app that loads a specific web page.</p>
  
  <p>On that web page is a button that uses JavaScript to call a method within the Android activity to reload the URL in the WebView (effectively resetting the web app to its default state).</p>
  
  <p>I've got all of the JavaScript interface to Android bit working thanks to a few threads here and I can pop up a <code>Toast</code> to show that the app is about to reload, but I'm getting an error with the WebView.loadUrl() call as follows.</p>
  
  <pre><code>java.lang.RuntimeException: java.lang.Throwable: A WebView method was called on thread 'JavaBridge'. All WebView methods must be called on the same thread. (Expected Looper Looper (main, tid 1) {1d015c84} called on Looper (JavaBridge, tid 122148) {33703881}, FYI main Looper is Looper (main, tid 1) {1d015c84})
  </code></pre>
  
  <p>I'm guessing that this is because the method that is doing the reload is not within the <code>onCreate</code> method for this activity which does all of the other <code>WebView</code> stuff but I'm not sure if this really is the problem and how to resolve it if it is - as the method that reloads the URL needs to be within the JavascripInterface class to be reachable from within the web-page.</p>