Android BasicResponseHandler - 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 BasicResponseHandler class.

This code example shows how to use the following methods:
    String url=String.format(format, loc.getLatitude(),
                             loc.getLongitude());
    HttpGet getMethod=new HttpGet(url);
     
    try { 
      ResponseHandler<String> responseHandler=new BasicResponseHandler();
      String responseBody=client.execute(getMethod,
                                         responseHandler);
      buildForecasts(responseBody);
       
      String page=generatePage();
     
      browser.loadDataWithBaseURL(null, page, "text/html",
                                  "UTF-8", null); 
    } 
    catch (Throwable t) {
      android.util.Log.e("WeatherDemo", "Exception fetching data", t);
      Toast 
        .makeText(this, "Request failed: "+t.toString(), Toast.LENGTH_LONG)
        .show();
8
CodeRank
This code example shows how to use the following methods:
            LOGGER.info("Fetching latest version number of eHour release from " + versionUrl);
 
            HttpGet request = new HttpGet(versionUrl);
            request.setHeader("User-Agent", String.format("%s eHour update client v%s", isScheduled ? "Scheduled" : "Bootstrap", currentVersion));
 
            BasicResponseHandler responseHandler = new BasicResponseHandler();
            String response = client.execute(request, responseHandler);
 
            return Optional.of(response);
        } catch (Exception e) {
            LOGGER.info("Failed to retrieve latest published eHour version: " + e.getMessage());
 
        } 
 
        return Optional.absent(); 
    } 
} 
7
CodeRank
This code example shows how to use the following methods:
				out.add(new BasicNameValuePair("status", params[0]));
				post.setEntity(new UrlEncodedFormEntity(out, HTTP.UTF_8));
				post.setParams(getParams());
				// sign the request to authenticate 
				mConsumer.sign(post);
				String response = mClient.execute(post, new BasicResponseHandler());
				jso = new JSONObject(response);
			} catch (UnsupportedEncodingException e) {
				e.printStackTrace();
			} catch (OAuthMessageSignerException e) {
				e.printStackTrace();
			} catch (OAuthExpectationFailedException e) {
				e.printStackTrace();
			} catch (OAuthCommunicationException e) {
				e.printStackTrace();
			} catch (ClientProtocolException e) {
				e.printStackTrace();
			} catch (IOException e) {
				e.printStackTrace();
			} catch (JSONException e) {
7
CodeRank
This code example shows how to use the following methods:
	public static String getContents(URI uri) throws Exception {
 
		if (uri == null) throw new NullPointerException("No URI provided.");
 
		HttpGet httpget = new HttpGet(uri);
		ResponseHandler<String> responseHandler = new BasicResponseHandler();
 
		log.debug("Retrieving from: " + uri);
		String responseBody = httpClient.execute(httpget, responseHandler);
		log.debug("Response size: " + responseBody.length() + " characters.");
 
		return responseBody;
	} 
} 
7
CodeRank
This code example shows how to use the following methods:
			// Network stuff 
			if (isNetworkConnected()) { 
				try { 
					HttpPost post = new HttpPost(urlString);
					HttpClient client = new DefaultHttpClient();
					ResponseHandler<String> responseHandler = new BasicResponseHandler();
					client.execute(post, responseHandler);
					String response = client.execute(post, responseHandler);
				} catch (Exception e) {
				} 
			} else { 
				((Activity) context).finish();
			} 
			return null; 
		} 
 
	} 
 
	private void initUi() { 
		// TO initialize UI 
6
CodeRank
This code example shows how to use the following methods:
    @Override 
    public boolean autenticateCredentials() throws IOException { 
        HttpGet authenticationTest = new HttpGet(QueryBuilder.authenticationCheck());
        authenticationTest.setHeader("Accept", "application/xml");
        try { 
            httpClient.execute(authenticationTest, new BasicResponseHandler());
        } catch (HttpResponseException e) {
            return false; 
        } 
        return true; 
    } 
 
    @Override 
    public UserData lookupUserData(Entity entityType, String mbid) throws IOException {
        HttpEntity entity = get(QueryBuilder.userData(entityType, mbid));
        UserData userData = responseParser.parseUserData(entity.getContent());
        entity.consumeContent();
        return userData;
    } 
 
6
CodeRank
This code example shows how to use the following methods:
		HttpPost post = new HttpPost("http://dwz.cn/create.php");
		post.getParams()
			.setParameter("url", url)
			.setParameter("alias", alias);
		try { 
			ResponseHandler<String> responseHandler = new BasicResponseHandler();
			String responseBody = client.execute(post, responseHandler);
			System.out.println(responseBody);
		} catch (ClientProtocolException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally { 
			client.getConnectionManager().shutdown();
		} 
	} 
	 
	public static void main(String[] args) {
		DwzManager m = new DwzManager();
		m.gendwz("http://www.hao123.com/", "");
6
CodeRank
This code example shows how to use the following methods:
		HttpPost post = new HttpPost("http://dwz.cn/create.php");
		post.getParams()
			.setParameter("url", url)
			.setParameter("alias", alias);
		try { 
			ResponseHandler<String> responseHandler = new BasicResponseHandler();
			String responseBody = client.execute(post, responseHandler);
			System.out.println(responseBody);
		} catch (ClientProtocolException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally { 
			client.getConnectionManager().shutdown();
		} 
	} 
	 
	public static void main(String[] args) {
		DwzController m = new DwzController();
		m.gendwz("http://www.hao123.com/", "");
6
CodeRank
This code example shows how to use the following methods:
		try { 
			Article a = e.getArticle();
			HttpClient client = new DefaultHttpClient();
			HttpPost post = new HttpPost(ADD_ARTICLE_URL);
			post.setEntity(new StringEntity(toPostString(a), "UTF-8"));
			ResponseHandler<String> responseHandler = new BasicResponseHandler();
			String responseBody = client.execute(post, responseHandler);
			log.info(responseBody);
		} catch (UnsupportedEncodingException ex) {
			log.error(ex.getMessage(), ex);
		} catch (ClientProtocolException ex) {
			log.error(ex.getMessage(), ex);
		} catch (IOException ex) {
			log.error(ex.getMessage(), ex);
		} 
	} 
 
	private String toPostString(Article a) {
		RhythmArticle obj = new RhythmArticle(a, getCfgs(), getUser().getLoginName());
		String str = JSON.toJSONString(obj, SerializerFeature.UseSingleQuotes);
6
CodeRank
This code example shows how to use the following methods:
 
  protected String fetch(String url) throws Exception {
    HttpClient httpclient = new DefaultHttpClient();
    HttpGet request = new HttpGet(url);
 
    return httpclient.execute(request, new BasicResponseHandler());
  } 
 
  /** 
   * Fetch content from a url, but only if it's more recent than the 
   * lastModified parameter, which is a unix timestamp. 
   *  
   * @param url  
   * @param lastModified  
   * @return the content or null if the content hasn't been changed 
   * @throws Exception if something goes wrong or status code is > 300 && != 304 
   */ 
  protected String fetch(String url, long lastModified) throws Exception {
    HttpGet request = new HttpGet(url);
    request.setHeader("If-Modified-Since", DateUtils.formatDate(new Date(lastModified)));
6
CodeRank

Related Android BasicResponseHandler Questions & Answers:

See Code Examples for Android BasicResponseHandler Methods: