List of open source Libraries
This article is going to describe some popular and useful android open source libraries. The use of these open source libraries makes android development fast, flexible and robust.
Android Annotation framework
AndroidAnnotations is an Open Source framework that speeds up Android development. It takes care of the plumbing, and lets you concentrate on what's really important. By simplifying your code, it facilitates its maintenance.
Dagger
A fast dependency injector framework for Android and Java
iText
An open source java and android library used for PDF generation. A sample demo with source code is posted here
AChartEngine – Charting API
As AChartEngine is a charting library for Android applications.
It currently supports the following chart types: There are more charting
APIs as well but the most flexible and open source API that I found is
AChartEngine.
- Line chart
- Area chart
- Scatter chart
- Time chart
- Bar chart
- Pie chart
- Bubble chart
- Doughnut chart
- Range (high-low) bar chart
- Dial chart / gauge
- Combined (any combination of line, cubic line, scatter, bar, range bar, bubble) chart
- Cubic line chart
Android Scripting
Scripting Layer for Android (SL4A) allows scripting language to be executed on android. Scripts can be run interactively in a terminal, in the background, or via Locale. Python, Perl, JRuby, Lua, BeanShell, JavaScript, Tcl, and shell are currently supported.
Gson is a Java library used for serializing and deserializing Java objects from and into JSON. A task you will frequently need to do if you communicate with APIs. We mostly use JSON because it’s lightweight and much simpler than XML.
// Serialize
String userJSON = new Gson().toJson(user);
// Deserialize
User user = new Gson().fromJson(userJSON, User.class);
It also plays nice with the next library:
From their site: "Retrofit turns your REST API into a Java interface.” It’s an elegant solution for organizing API calls in a project. The request method and relative URL are added with an annotation, which makes code clean and simple.
With annotations, you can easily add a request body, manipulate the URL or headers and add query parameters.
Adding a return type to a method will make it synchronous, while adding a Callback will allow it to finish asynchronously with success or failure.
As we can see from the examples above, most of the new Android libraries and tools available are indicating a need for lightweight and simpler libraries that work in unstable environments which everyone can use. There is also a little confusion between Android & Java, where things are ported from Android to Java and vice versa but if you can write something that works on both, then why not do it.
GSON
Gson is a Java library used for serializing and deserializing Java objects from and into JSON. A task you will frequently need to do if you communicate with APIs. We mostly use JSON because it’s lightweight and much simpler than XML.
// Serialize
String userJSON = new Gson().toJson(user);
// Deserialize
User user = new Gson().fromJson(userJSON, User.class);
It also plays nice with the next library:
RETROFIT
From their site: "Retrofit turns your REST API into a Java interface.” It’s an elegant solution for organizing API calls in a project. The request method and relative URL are added with an annotation, which makes code clean and simple.
With annotations, you can easily add a request body, manipulate the URL or headers and add query parameters.
Adding a return type to a method will make it synchronous, while adding a Callback will allow it to finish asynchronously with success or failure.
Conclusion
As we can see from the examples above, most of the new Android libraries and tools available are indicating a need for lightweight and simpler libraries that work in unstable environments which everyone can use. There is also a little confusion between Android & Java, where things are ported from Android to Java and vice versa but if you can write something that works on both, then why not do it.
No comments:
Post a Comment