title: Unable to start receiver: android.os.NetworkOnMainThreadException with android JellyBean
body: <p>I'm trying to develop a widget that updates itself every minute by a json resource, my problem is that when i try to launch it on jellybean it crashes, while with gingerbread works.</p>
  
  <p>I saw <a href="https://stackoverflow.com/questions/11347754/how-to-avoid-networkonmainthread-exception-without-using-asynctask">here</a> that i must move all internet connection to the main thread, right?
  At the moment i've a class called HttpRequest:</p>
  
  <pre><code>public class HttpRequest {    
      private String url;
  
      public HttpRequest(String url)
      {       
          this.url = url;
      }
  
      public String GetContent() throws ClientProtocolException, IOException
      {
          HttpClient client = new DefaultHttpClient();
          HttpGet request = new HttpGet(url);
          HttpResponse response = client.execute(request);
  
          String html = "";
          InputStream in = response.getEntity().getContent();
          BufferedReader reader = new BufferedReader(new InputStreamReader(in));
          StringBuilder str = new StringBuilder();
          String line = null;
          while((line = reader.readLine()) != null)
          {
              str.append(line);
          }
          in.close();
          html = str.toString();
          return html;
      }
  }
  </code></pre>
  
  <p>Every minute is called updateAppWidget() that is a method of WidgetProvider class.
  Inside updateAppWidget() there is:</p>
  
  <pre><code>HttpRequest r = new HttpRequest("http://www.hwlogos.com/test.json");
  remoteViews.setTextViewText(R.id.ip, r.GetContent());
  </code></pre>
  
  <p>Can you tell me how solve it steep by steep? 
  thanks</p>