Android HttpGet - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android HttpGet class.

This code example shows how to use the following methods:
  void retrieveSupplementalInfo() throws IOException, InterruptedException { 
 
    String encodedProductID = URLEncoder.encode(productID, "UTF-8");
    String uri = BASE_PRODUCT_URI + encodedProductID;
 
    HttpUriRequest head = new HttpGet(uri);
    AndroidHttpClient client = AndroidHttpClient.newInstance(null);
    HttpResponse response = client.execute(head);
    int status = response.getStatusLine().getStatusCode();
    if (status != 200) {
      return; 
    } 
 
    String content = consume(response.getEntity());
    Matcher matcher = PRODUCT_NAME_PRICE_PATTERN.matcher(content);
    if (matcher.find()) {
      append(matcher.group(1));
      append(matcher.group(2));
    } 
    setLink(uri);
Full Snippet Info
9
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
		if (uri.indexOf("http://") == -1)
			uri = "http://" + uri;
		boolean reached = isAvailable();
		try { 
			DefaultHttpClient httpclient = new DefaultHttpClient();
			HttpGet httpget = new HttpGet(uri);
			httpclient.execute(httpget);			
		} catch (Exception e) { 
			reached = false;
		} 
		return reached;
	} 
	 
	 
} 
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: addHeader, getParams
        if (DEBUG) Log.d(TAG, "Downloading XTRA data from " + url);
 
        AndroidHttpClient client = null;
        try { 
            client = AndroidHttpClient.newInstance("Android");
            HttpUriRequest req = new HttpGet(url);
 
            if (isProxySet) {
                HttpHost proxy = new HttpHost(proxyHost, proxyPort);
                ConnRouteParams.setDefaultProxy(req.getParams(), proxy);
            } 
 
            req.addHeader(
                    "Accept", 
                    "*/*, application/vnd.wap.mms-message, application/vnd.wap.sic"); 
 
            req.addHeader(
                    "x-wap-profile", 
                    "http://www.openmobilealliance.org/tech/profiles/UAPROF/ccppschema-20021212#"); 
 

8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
        } 
 
        @Override 
        public HttpResponse call() throws Exception {
            try { 
                return client.execute(new HttpGet(url));
            } finally { 
                client.getConnectionManager().closeExpiredConnections();
            } 
        } 
    } 
} 
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
     * @param graceTime 
     * @return 
     * @throws IOException 
     */ 
    public static HttpResponse tryGet(final HttpClient client, final String url, final long graceTime) throws IOException {
        return tryGet(client, new HttpGet(url));
    } 
 
    /** 
     * Tries a get on the provided client consuming the request body. 
     * 
     * @param client 
     * @param url 
     * @return response body as string 
     * @throws IOException 
     */ 
    public static String tryGetAndConsume(final HttpClient client, final String url) throws IOException {
        // Get the response 
        HttpResponse response = tryGet(client, url);
 
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android HttpGet Questions & Answers:

Other Android HttpGet Examples

65:						url += "?" + paramString;
66:					}
67:					HttpGet httpGet = new HttpGet(url);
68:	
69:					httpResponse = httpClient.execute(httpGet);
-
65:						url += "?" + paramString;
66:					}
67:					HttpGet httpGet = new HttpGet(url);
68:	
69:					httpResponse = httpClient.execute(httpGet);

Read More

70:						url += "?" + paramString;
71:					}
72:					HttpGet httpGet = new HttpGet(url);
73:	
74:					httpResponse = httpClient.execute(httpGet);
-
70:						url += "?" + paramString;
71:					}
72:					HttpGet httpGet = new HttpGet(url);
73:	
74:					httpResponse = httpClient.execute(httpGet);

Read More

56:					String paramString = URLEncodedUtils.format(params, "utf-8");
57:					url += "?" + paramString;
58:					HttpGet httpGet = new HttpGet(url);
59:	
60:					HttpResponse httpResponse = httpClient.execute(httpGet);
-
56:					String paramString = URLEncodedUtils.format(params, "utf-8");
57:					url += "?" + paramString;
58:					HttpGet httpGet = new HttpGet(url);
59:	
60:					HttpResponse httpResponse = httpClient.execute(httpGet);

Read More

See Code Examples for Android HttpGet Methods: