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