Use of the Xutils Android framework

Source: Internet
Author: User

The following permissions are required to use the Xutils rapid development framework:
<uses-permission android:name= "Android.permission.INTERNET"/><uses-permission android:name= " Android.permission.WRITE_EXTERNAL_STORAGE "/>

These two pieces of code are put into the Androidmanifest.xml file.

Using the Xutils framework, just import the jar package from the download folder into the project and it's OK.

Requestparams params =Newrequestparams ();//It's added to the header.Params.addheader ("name", "value"));//GetParams.addquerystringparameter ("name", "value"));//bodyparamsentity is used by default when only string parameters are included.//similar to urlencodedformentity ("application/x-www-form-urlencoded"). //web:request.getParameter ("name");Params.addbodyparameter ("name", "value"));//multipartentity ("Multipart/form-data") is used by default after adding file parameters.//For "multipart/related", the Multipartentity support settings provided in Xutils are subtype "related". //use Params.setbodyentity (httpentity) to set more types of httpentity, such as://multipartentity,bodyparamsentity,fileuploadentity,inputstreamuploadentity,stringentity). //For example, send JSON parameter: params.setbodyentity (new Stringentity (Jsonstr,charset));Params.addbodyparameter ("File",NewFile ("path"));

(I'll use it later, then update it)

Use of the Xutils Android framework

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.