title: Using another thread for "networking" , in Android
body: <p>I am developing an Android application and when it launches :</p>
  
  <p><strong>1)</strong> I make an HTTP Request to my server to send a small JSON file.</p>
  
  <p><strong>2)</strong> Open a webView to show a URL. </p>
  
  <p>When the server is running properly there is absolutely no problem and everything goes smoothly.</p>
  
  <p><strong>HOWEVER</strong> , if for any reason the server is down , the HTTP request literally hangs and i need to wait till there is an HTTP timeOut which is around 30seconds till i actually see the webView with the URL loading.</p>
  
  <p>I read that i shouldn't make any <em>networking</em> inside the UI thread and i should use another thread for that.</p>
  
  <p>In BlackBerry , that i have already developed the application for , this is as simple as that :</p>
  
  <pre><code>new Thread(){
    public void run(){
      HttpConnection hc = 
              (HttpConnection)Connector.open("http://www.stackoverflow.com");
    }
  }.start();
  </code></pre>
  
  <p>I just start a new thread and inside i make the requests and all the necessary <em>networking</em>. That way , even when my server is not reachable the webView is loaded immediately without making the user wait and sense that the app is actually hanging.</p>
  
  <p>How could i do exactly the same in Android , easiest way possible ?</p>