title: Android HTTP Request AsyncTask
body: <p>I want to implement a class which will handle all HTTP Requests of my application, which will be basically:</p>
  
  <ul>
  <li>Get a list of business (GET);</li>
  <li>Execute a login (POST);</li>
  <li>Update the location (POST).</li>
  </ul>
  
  <p>So, I will have to get the result string from the server (JSON) and pass it to another methods to handle the responses.</p>
  
  <p>I currently have this methods:</p>
  
  <pre><code>public class Get extends AsyncTask&lt;Void, Void, String&gt; {
      @Override
      protected String doInBackground(Void... arg) {
          String linha = "";
          String retorno = "";
  
          mDialog = ProgressDialog.show(mContext, "Aguarde", "Carregando...", true);
  
          // Cria o cliente de conexão
          HttpClient client = new DefaultHttpClient();
          HttpGet get = new HttpGet(mUrl);
  
          try {
              // Faz a solicitação HTTP
              HttpResponse response = client.execute(get);
  
              // Pega o status da solicitação
              StatusLine statusLine = response.getStatusLine();
              int statusCode = statusLine.getStatusCode();
  
              if (statusCode == 200) { // Ok
                  // Pega o retorno
                  BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
  
                  // Lê o buffer e coloca na variável
                  while ((linha = rd.readLine()) != null) {
                      retorno += linha;
                  }
              }
          } catch (ClientProtocolException e) {
              e.printStackTrace();
          } catch (IOException e) {
              e.printStackTrace();
          }
  
          return retorno;
      }
  
      @Override
      protected void onPostExecute(String result) {
          mDialog.dismiss();
      }
  }
  
      public JSONObject getJSON(String url) throws InterruptedException, ExecutionException {
          // Determina a URL
          setUrl(url);
  
          // Executa o GET
          Get g = new Get();
  
          // Retorna o jSON
          return createJSONObj(g.get());
      }
  </code></pre>
  
  <p>But the <code>g.get()</code> returns a empty response. How can I fix that?</p>