Skip to content

shenkaige/AndroidHttpTools

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

AndroidHttpTools

a simple HTTP request tools,support get,post,post with files

//------------------------Sample Code------------------------//

String url = "http://www.baidu.com/";

private void requestData() {
	ConnectionHelper conn = ConnectionHelper.obtainInstance();
	long requstHandler = conn.httpGet(url, 0, rr);
	// support cancel
	// conn.cancleRequest(requstHandler);
}

private void reqeustData2() {
	ConnectionHelper.obtainInstance().execute(
			RequestEntity.obtain().url(url).method(RequestMethod.GET)
					.receiver(rr));
}

private RequestReceiver rr = new RequestReceiver() {

	@Override
	public void onResult(int resultCode, int reqId, Object tag, String resp) {
		if (resultCode == RESULT_STATE_OK) {
			// reqeustion ok
		} else {
			// reqeust error
		}
	}

	@Override
	public void onRequestCanceled(int reqId, Object tag) {
		// on canceled
	}
};

About

a simple HTTP request tools,support get,post,post with files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages