Code example for DefaultHttpClient

Methods: execute

0
		this.serverUri = serverUri;
	} 
 
	public Onibus executaComParametro(String param) {
		try { 
			DefaultHttpClient client = new DefaultHttpClient();
			HttpGet get = new HttpGet(serverUri+"?"+param);
 
			HttpResponse response = client.execute(get);
 
			String json = EntityUtils.toString(response.getEntity());
 
			Log.i("JSON retornado pelo SERVER", "JSON:"+json);
			 
			Gson gson = new GsonBuilder().create();
			Onibus busao = gson.fromJson(json, Onibus.class);
 
			return busao;
		} catch (Exception e) {
			Log.e("ZICA!!", e.toString());
			return new Onibus();