Code example for AndroidHttpClient

Methods: execute

0
		post.setHeader("Accept", "application/json");
		post.setHeader("Content-type", "application/json; charset=UTF-8");
		post.setHeader("Content-Encoding", "UTF-8");
		ByteArrayEntity ent = new ByteArrayEntity(data.getBytes("UTF-8"));
		post.setEntity(ent);
		String response = getClient().execute(post, responseHandler);
 
		return response;
	} 
 
	private String postWithoutApiKey(String url, String data) throws ClientProtocolException, IOException	
	{		 
		ResponseHandler<String> responseHandler = new BasicResponseHandler();
		HttpPost post = new HttpPost(String.format("http://www.gettodone.dk/api%s", url));
		post.setHeader("Accept", "application/json");
		post.setHeader("Content-type", "application/json");
		post.setEntity(new StringEntity(data));
		String response = getClient().execute(post, responseHandler);
 
		return response;
	}