Android xutils Frame

Source: Internet
Author: User

Android xutils Frame(ext.)

Directory (?) [-]

    1. Xutils Introduction
    2. Currently Xutils has four main modules
    3. The following permissions are required to use the Xutils rapid development Framework
    4. Considerations when confusing
    5. Dbutils How to use
    6. Viewutils How to use
    7. Httputils How to use
      1. Normal Get method
      2. Uploading files using Httputils or submitting data to the server post method
      3. Download files using Httputils
    8. Bitmaputils How to use
    9. See the code in the sample folder for more sample code
      1. Output Log Logutils
Xutils Introduction
    • Xutils contains a lot of useful Android tools.
    • Xutils from the afinal framework, the afinal has been heavily reconstructed, allowing the xutils to support large file uploads, more comprehensive HTTP request protocol support, more flexible ORM, more event annotations support, and no confusion affected ...
    • XUITLS Minimum compatible Android 2.2 (API Level 8)
Currently Xutils has four main modules:
  • Dbutils module:

    • The ORM framework in Android, a line of code can be used for the enhancement and deletion;
    • Support transactions, closed by default;
    • Annotations can be used to customize table names, column names, foreign keys, uniqueness constraints, NOT NULL constraints, check constraints, etc. (Please note the table and column names when confusion is required);
    • Support for binding foreign keys, saving entities when the foreign key associated entities are automatically saved or updated;
    • Automatic loading of foreign key associated entities, support delay loading;
    • Support chain expression query, more intuitive query semantics, refer to the following introduction or sample examples.
  • Viewutils module:

    • The IOC framework in Android enables UI binding and event binding in a fully annotated manner;
    • New event binding mode, the use of obfuscation tools can still work properly;
    • Currently supports 11 commonly used event bindings, see Viewcommoneventlistener Class and package com.lidroid.xutils.view.annotation.event.
  • Httputils module:

    • Support synchronous, asynchronous requests;
    • Support large file upload, upload large files will not oom;
    • Support Get,post,put,move,copy,delete,head request;
    • Download support 301/302 Redirect, support setting whether to rename downloaded files according to Content-disposition;
    • A GET request that returns text content supports caching, which sets the default expiration time and the expiration time for the current request.
  • Bitmaputils module:

    • When loading the bitmap, there is no need to consider the phenomenon of the image dislocation when the Oom and the Android container move quickly during the bitmap loading process.
    • Support to load network pictures and local images;
    • The memory management uses the LRU algorithm, better manages the bitmap memory;
    • Configurable line preempted thread count, cache size, cache path, load display animation, etc...
The following permissions are required to use the Xutils rapid development Framework:
Things to note when confusing:
    • Do not confuse the annotation type in xutils, add confusion Configuration:-keep class * extends Java.lang.annotation.Annotation {*;}
    • Do not confuse entity classes that use Dbutils module persistence, or annotate all table and column names @table (name= "xxx"), @Id (column= "xxx"), @Column (column= "xxx"), @Foreign (column= "XXX", foreign= "xxx");
Dbutils How to use:
Viewutils How to use
    • UI binding and event binding can be done in a fully annotated manner.
    • No need for Findviewbyid and Setclicklistener.
Httputils How to use: Normal Get method
Uploading files using Httputils or submitting data to the server (POST method)
Requestparams params = new Requestparams (); Params.addheader ("name", "value"); Params.addquerystringparameter ("name", "value"); Bodyparamsentity is used by default when only string parameters are included,//similar to urlencodedformentity ("application/x-www-form-urlencoded"). Params.addbodyparameter ("name", "value"); Multipartentity ("Multipart/form-data") is used by default after adding the file parameters,//If "multipart/related" is required, 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). Params.addbodyparameter ("File", new file ("path")); ... Httputils http = new Httputils (); Http.send (HttpRequest.HttpMethod.POST, "Uploadurl ...", params, new requestcallback<string> () {@Override public void OnStart () {testtextview.settext ("conn ..."); @Override public void onloading (long total, long current) {Testtextview.settext (current + '/' + total);} @Override Publi c void onsuccess (String result) {Testtextview.settext ("Upload response: "+ Result.getpath ());} @Override public void OnFailure (httpexception error, String msg) {Testtextview.settext (Error.getexceptioncode () + ":" + M SG);  } });
To download a file using httputils:
    • Support breakpoint continuation, stop downloading task at any time, start task
Bitmaputils How to use
Other (* * * More sample code see code in the sample folder * * *) output log logutils

Android xutils Frame

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.