title: How to make a Http Get fast request?
body: <p>actually i have a correct code that makes a http petition to twitter and get's some tweets from a user codified with JSON (it gets a file .json)</p>
  
  <p>It's ok, it works fine, but it takes a loooooooooooooot of time making the request, debugging i can see that the problem is on the line <code>HttpResponse response = httpclient.execute(httpget);</code></p>
  
  <p>On that line it gets stuck a lot of seconds when the number of tweets is more than 3 or 4 tweets. If you are requesting 20 tweets it takes 10-15 seconds to get them.</p>
  
  <p>It is a problem of the java/android http get method i am using, because if i make the request by url on firefox, then, it is super fast.</p>
  
  <p><strong>How to make this http get request by a faster way?</strong></p>
  
  <p>This is my actual and slow code: </p>
  
  <pre><code>public List&lt;String&gt; RetrieveTweets(String name, int num) //da todas las posiciones dado un email
  {
      // https://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&amp;include_rts=true&amp;screen_name=charliesheen&amp;count=2
      List&lt;String&gt; tweetsList= new ArrayList&lt;String&gt;(); 
      String result = "";
      //http get
      InputStream is=null;
      try{
              HttpClient httpclient = new DefaultHttpClient();
              HttpGet httpget = new HttpGet("https://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&amp;include_rts=true&amp;screen_name=" + name +"&amp;count="+ num);
              HttpResponse response = httpclient.execute(httpget);
              HttpEntity entity = response.getEntity();
              is = entity.getContent();
      }catch(Exception e){
              Log.e("log_tag", "Error in http connection "+e.toString());
      }
      //convert response to string
      try{
              BufferedReader reader = new BufferedReader(new InputStreamReader(is,"iso-8859-1"),8);
              StringBuilder sb = new StringBuilder();
              String line = null;
              while ((line = reader.readLine()) != null) {
                      sb.append(line + "\n");
              }
              is.close();
              result=sb.toString();
      }catch(Exception e){
              Log.e("log_tag", "Error converting result "+e.toString());
      }
      //parse json data
      try{
              JSONArray jArray = new JSONArray(result);
              for(int i=0;i&lt;jArray.length();i++)
              {
                      JSONObject json_data = jArray.getJSONObject(i);
                      tweetsList.add(json_data.getString("text")); //text es el nombre del campo del tweet
              }
      }
      catch(JSONException e){
              Log.e("log_tag", "Error parsing data "+e.toString());
      }
      return tweetsList;
  }
  </code></pre>