title: Sometimes my app crashes with UnknownHostException
body: <p>In my app i have access to web server. It works fine in Some phones but while testing in <strong>Samsung Galaxy 
  Model No - GT-S5830i
  Android Version - 2.3.6</strong>
  it keeps on showing Unknown host exception. I have checked the url from   browser its working fine.</p>
  
  <pre><code>private void submitUploadData(String url ,Map&lt;String, String&gt; param) throws IOException 
  {  
      URL siteUrl;
      try {
          siteUrl = new URL(url); 
      HttpURLConnection conn = (HttpURLConnection) siteUrl.openConnection();
      conn.setRequestMethod("POST");
      conn.setDoOutput(true);
      conn.setDoInput(true);
  
      DataOutputStream out = new DataOutputStream(conn.getOutputStream());
  
      Set getkey = param.keySet();
      Iterator keyIter = getkey.iterator();
      String content = "";
      for(int i=0; keyIter.hasNext(); i++) {
          Object key = keyIter.next();
          if(i!=0) {
              content += "&amp;";
          }
          content += key + "=" +  param.get(key);
      } 
      out.writeBytes(content.trim()); 
      out.flush();
      out.close();
      BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); 
      String line = "";
      while((line=in.readLine())!=null) {
          System.out.println(line);
      }
      in.close();  
      //Intent home = new Intent(SyncHttp.this,TimeAndExpensesSKActivity.class);
      //startActivity(home);
      db.updateTimeExported(1);
      db.updateExpensesExported(1);
      db.close();
      db.close(); 
  
      if(db.getLogCount()==0){ 
              db.insertSyncDateDetails(getDateandTime());}
              else{
              db.updateSyncDateDetails(1, getDateandTime());}  
  
  
      } catch (MalformedURLException e) { 
          e.printStackTrace();
      }
      this.setResult(FINISH_RESULT);
      db.close();
  }
  </code></pre>
  
  <p>I have already added permissions </p>
  
  <pre><code> &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
   &lt;uses-permission android:name="android.permission.CAMERA" /&gt;
   &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/&gt;
   &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
   &lt;uses-permission android:name="android.permission.READ_PHONE_STATE"/&gt; 
  </code></pre>
  
  <p>I am really confused why this exception occurring. </p>
  
  <p>Thanks for your help guys.</p>