Send method parameter list:
1. Httprequest.httpmethod method Request method
HttpRequest.HttpMethod.GET GET Mode
HttpRequest.HttpMethod.POST POST Mode
2.String URL Request URLs
3.RequestParams params Parameter object, objects stored as key-value pairs, automatically spliced (without parameters, using the three-parameter send method)
Object creation: Requestparams params = new Requestparams ();
Params.addquerystringparameter ("Method", "info");
Params.addquerystringparameter ("Access_token",
"3.1042851f652496c9362b1cd77d4f849b.2592000.1377530363.3590808424-248414");
4.requestcallback<t> callBack Callback Notification interface,
Onsuccess callback method after a successful request for this action
OnFailure failed callback, not referring to the server return data tells you to fail, but there is a network error ah, the server problem ah, and so on this error
httputils httputils = new Httputils (); Httputils.send (HttpRequest.HttpMethod.GET, "http://www.baidu.com", Span style= "color: #0000ff;" >new requestcallback<string> () {@Override // callback public Responseinfo) {
} // callback with request action failure, not referring to the server return data tells you to fail, but there is a network error ah, the server problem ah, and so on. @Override public void< Span style= "color: #000000;" > OnFailure (httpexception error, String msg) {
}});
Httputils Download method (supports breakpoint continuation): The following are the overloads of the method:Parameters:1. String URL 2. String Target Download file storage location 3. Requestcallback<file>Callback Callback Notification interface download (string URL, string target,requestcallback<file>callback) {} download (string URL, string target,Boolean Autoresume, requestcallback<file>Callback) {}4. When Boolean Autoresume is true, if the destination file exists, then the unfinished portion continues to download. 5.booleanWhen Autorename is true, if the file name is obtained from the request return information, the download is automatically renamed after the download (string URL, string target,Boolean Autoresume,Boolean autorename, requestcallback<file>Callback) {}Add parameter to download download (string URL, string target, requestparams params, requestcallback<file>callback) {} download (string URL, string target, requestparams params,Boolean Autoresume, requestcallback<file>callback) {} download (string URL, string target,requestparams params,Boolean Autoresume, boolean autorename, requestcallback<file> callback) {} //Specify access network mode download ( Httprequest.httpmethod method, string url, string target,requestparams params, requestcallback<file> callback) {} download (Httprequest.httpmethod method, string url, string target,requestparams params, Boolean Autoresume, requestcallback<file> callback) {} download (Httprequest.httpmethod method, string URL, string Target, Requestparams params, boolean Autoresume, boolean autorename, Requestcallback<file> callback ) {}
Uploading and downloading video from Android