5 Open source libraries that Android developers must know
Source: Internet
Author: User
KeywordsOpen Source Library developer can Java very
In the past, Android development has matured, with Android-related development tools emerging. However, in the face of a variety of new things, do not forget those we use every day a large number of open source library. Here, I would like to introduce to you, in this hard-working family, the most popular developer favorite five Android libraries. Hopefully, by understanding them, you can help with your development efforts.
1. Gson
Gson is a Java class library that Google provides to map between Java objects and JSON data. can be used to convert a Java object to a corresponding JSON representation, or you can convert a JSON string to an equivalent Java object. If you're dealing with the API, it's going to be something you often need. Our main reason for using JSON is that, compared to XML, lightweight JSON is much simpler.
2. Retrofit
As described on its website, "Retrofit your rest API into Java interface," Retrofit the data returned by the rest API into Java objects for easy operation, which is a good solution for organizing API calls in projects. Both the request method and the relative URL are annotated, making the code more concise. With annotations, you can easily add a request body, manipulate a URL or header file, and add query parameters. In addition, each function can be defined as synchronous or asynchronous, and functions with return values are executed synchronously, while asynchronous functions do not return a value and the last parameter is a callback object.
Retrofit uses Gson by default, so no custom parsing is required, and other converters are supported.
3. Eventbus
Eventbus is a library that simplifies communication between parts of an application. such as sending messages from an activity to a running service, or simply interacting between fragments. The example below is how to notify an activity if the http://www.aliyun.com/zixun/aggregation/18415.html > Network connection is lost:
4. Activeandroid
Activeandroid is a lightweight ORM (Object Relational mapping) that allows you to save and retrieve SQLite database records without writing a separate SQL statement. Each database record is neatly grouped into one category, such as the Delete () and save () methods.
Extended Activeandroid Model objects can be stored in a database, such as:
Activeandroid is a great way to remove a lot of boilerplate code that works with the database. Of course, there are other open source solutions, such as Greendao and Ormlite.
5. UNIVERSAL IMAGE LOADER
UIL is an open source project designed to provide a reusable instrument for loading, caching, and displaying asynchronous images. It's easy to use:
Although Picasso has a better API, it lacks customization. With the UIL Builder, you can configure almost all of them, the most important of which is that Picasso will fail when you crawl and cache large pictures.
A good open source library will make your development simpler and faster, while popular libraries are often well tested and easy to use. In most cases, you can easily import them from Maven into the Android studio project. Add them to the Build.gradle file for the dependency. And after synchronization, you will be able to implement them well in your application.
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.