Android-async-http

Source: Internet
Author: User

Installation

http://blog.csdn.net/wangwei_cq/article/details/9453345

Some of the basic parameters within the package

Http://www.cnblogs.com/manuosex/p/3583775.html

My use of the situation

13File Upload interface (Form form submission) function: Upload file to the server, then return the URL of the file, the last JPG representation type, if it is txt return the URL type is txt description: No login address: http://123.57.54.254:8090/api/values/postfileholeform/jpgmethod: Post request Type: No return type: {"Result": "TRUE", "Reason": "", "url": "Http://123.57.54.254/file/7AAD853A05E394EAC8E07654FE62DFD9.jpg"Well, the method is post, and the request type is none! Requestparams for nothing, so? iOS upload is a body object, the solution is Params.put ("File",Newfile (path), the request parameter "file" as the body client.post (URL, params,NewAsynchttpresponsehandler () {@Override Public voidOnsuccess (intStatusCode, header[] headers,byte[] responsebody) {                    Try {                        if(StatusCode = = 200) {Toast.maketext (userinfoheadactivity. This,                                    "Avatar uploaded successfully!", 0). Show (); String Response=NewString (responsebody);                                                                                Paresjsonwithgson (response); } Else{toast.maketext (userinfoheadactivity). This,                                    "Network access exception, error code:" + StatusCode, 0). Show (); }                    } Catch(Exception e) {//TODO auto-generated Catch blockE.printstacktrace (); }} @Override Public voidOnFailure (intStatusCode, header[] headers,byte[] responsebody, throwable error) {Toast.maketext (userinfoheadactivity). This,                            "Network access exception, error code >" + StatusCode, 0). Show (); }            });

Android-async-http

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.