Introduction to six recommended open-source Android frameworks
1. volley
Project address https://github.com/smanikandan14/Volley-demo
Asynchronous download of JSON and images;
Network request sorting scheduling)
Priority processing of network requests
Cache
Multi-level cancellation request
All network requests are canceled at the end of the interaction with Activity and lifecycle)
2. android-async-http
Project address: Workshop/
Process request results in anonymous callback
Http requests outside the UI thread
File resumable upload
Smart retry
Default gzip Compression
Json format
Cookies can be persisted to SharedPreferences.
3. Afinal framework
Project address: https://github.com/yangfuhai/afinal
There are four main modules:
Database module: The orm framework in Android, which uses a thread pool to operate sqlite.
Annotation module: ioc framework in Android. UI binding and event binding can be performed in full annotation mode. No need for findViewById and setClickListener.
Network Module: Uses httpclient to encapsulate http data requests. It supports Ajax loading and file download and upload.
Image cache module: when using FinalBitmap and imageview to load bitmap, you do not need to consider the oom and Android container image dislocation during the bitmap loading process.
FinalBitmap can be used to configure the number of threads loaded, cache size, cache path, and display animation. The memory management of FinalBitmap uses the lru algorithm. If weak references are not used, Google does not recommend weak references. If weak references are not used, Google forcibly recycles soft references and weak references. For details, see the official Android documentation ), better management of bitmap memory. FinalBitmap can be used to customize the download tool to expand other protocols to display network images, such as ftp. You can also customize the bitmap display,
By default, gradient animations are displayed when you play an animation in imageview ).
4. xUtils framework
Project address: https://github.com/wyouflf/xutils. there are four main topics:
Database module:
The orm framework in Android allows you to add, delete, modify, and query a line of code;
Supports transactions, which are disabled by default;
You can use annotations to customize table names, column names, foreign keys, uniqueness constraints, not null constraints, CHECK constraints, and so on. Note the table names and column names when obfuscation is required );
Supports binding foreign keys. when an object is saved, the foreign key associated with the object is automatically saved or updated;
Automatically attach external key associated entities, supporting delayed loading;
Supports chained expression query and more intuitive query semantics. For more information, see the following introduction or examples in the sample.
Annotation module:
The ioc framework in Android can be fully annotated for UI, resource and event binding;
The new event binding method can still work normally after obfuscation using obfuscation tools;
Currently, You can bind 20 Common events. For details, see View Common Event Listener class and package com. lidroid. xutils. view. annotation. event.
Network Module:
Supports synchronous and asynchronous requests;
Supports uploading large files, so uploading large files does not involve oom;
Supports GET, POST, PUT, MOVE, COPY, DELETE, HEAD, OPTIONS, TRACE, and CONNECT requests;
Downloading supports 301/302 redirection and allows you to set whether to rename the downloaded file based on Content-Disposition;
By default, only GET requests are enabled for requests that return text content. cache is supported. You can set the default expiration time and the expiration time for the current request.
Image cache module:
When loading bitmap, you do not need to consider the oom and Android container image dislocation during the bitmap loading process;
Supports loading network images and local images;
Memory Management uses the lru algorithm to better manage bitmap memory;
You can configure the number of threads to load, cache size, cache path, and display animation.
5. ThinkAndroid
Project address: https://github.com/white-cat/ThinkAndroid
The main modules are as follows:
MVC module: separates views from models.
Ioc module: The ioc module in Android, which can be fully annotated to perform UI binding, read resources in res, and initialize objects.
Database module: The orm framework in Android, which uses a thread pool to operate sqlite.
Http module: Uses httpclient to encapsulate http data requests and supports asynchronous and synchronous loading.
Cache module: cache can be well implemented through simple configuration and design, and cache can be freely configured
Image cache module: when loading images in imageview, you do not need to consider the oom and Android container image misplacement during image loading.
Configurator module: You can perform simple pairing configuration operations. Currently, the configuration file supports Preference and Properties for configuration access.
Log printing module: This module allows you to print logs quickly and easily. It supports log printing extension. Currently, it supports writing sdcard to local printing and console printing.
Download Device Module: You can easily implement multi-threaded download, background download, resumable download, download control, such as start, pause, and delete.
Network status detection module: Checks network status changes.
6. LoonAndroid
Project address: https://github.com/gdpancheng/LoonAndroid
The main modules are as follows:
The automatic injection framework only needs to inherit the apps in the framework)
The image loading framework has multiple caches and is automatically recycled to maximize Memory Security)
The Network request module inherits basically all current http requests)
Eventbus integrates an open-source framework)
Verification Framework integrated with open-source framework)
Json parsing supports parsing to a set or object)
The database does not know which one has forgotten it)
Multi-thread breakpoint downloads automatically determine whether multithreading is supported and whether redirection is supported)
Automatic update Module
A series of tools
Among them, Volley has been studied in 2013 and has excellent scalability and preferred style. Others such as Android-async-http and Afinal are also quite good.