title: Display loading dialog while running method in Android?
body: <p>I have a method setup that takes about 3-5 seconds to run (because it does something online) and I would like to show a loading dialog, but I cant figure out how to do it, I tried starting the loading dialod before I called the method then tried to dismiss it right after like this:</p>
  
  <pre><code>dialog.show();
  myMethod();
  dialog.cancel();
  </code></pre>
  
  <p>But that didn't work, does anyone have any suggestions?</p>