Smarter ideas worth writing about.

Android Open Source Toolkit

 

As a long time JAVA developer, I'm used to having many tools from the open source world available to me to help me develop software. Tools like Spring, Hibernate, and the Common libraries are at the disposal of the JAVA developer and are commonly used.  As I transitioned to the Android space, I was hoping to find similar libraries to help speed development. I’ve compiled a list of some of the more popular libraries out there, nominally grouped by the problem they solve.

 

Dependency Injection 

I've been using Spring for years in my JAVA development, so one of the first things I looked for was a DI framework that worked in Android. I was surprised that Spring hasn't done DI yet for Android. There are three libraries, however, that seem to be seem to be used the most in this space

RoboGuice  

This was to my knowledge the first DI framework for Android.  Based on Google Guice, RoboGuice allows users to inject members into Activities.  Instead of having to instantiate your text views with findViewById, developers can inject them with annotations. Unfortunately, to use RoboGuice, you'll have to extend their Robo* classes.  I tried out RoboGuice and found it too slow in my applications.https://github.com/roboguice/roboguice/wiki

Android Annotations

Similar to RoboGuice, Android Annotations will allow users to inject views into activities. Unlike RoboGuice, it's completely annotation based, so you are not forced to extend their classes. When I first looked at Android Annotations, they didn't support singletons, so I tried RoboGuice instead. AA now supports singeltons now, so it may be worth looking into again. http://androidannotations.org/

Dagger

Based on the standard javax inject annotation, Dagger is the new kid on the block. Dagger is not strictly for Android, but was built with mobile in mind.  From my limited view of how it works, you wouldn't use Dagger to inject Android specific things, like views into activities, but you would use it in typical DI things you would look at and think "this is where I wish I had Spring" http://square.github.io/dagger/

 

ORM

Again, in the JAVA space, most developers looking to interface with a database are used to using a ORM mapping tool such as Hibernate or MyBatis.  Android devices come with SQLite. iOS Developers have Core Data, but Android expects developers to do most of the work by hand.  Hibernate is too big and bulky to be used on a mobile device. So where does a developer turn?

OrmLite  

OrmLite is java library that supports SQLite by accessing the native Android APIs. It is lightweight when compared to typical ORMs like Hibernate.  I haven't had enough local DB access to feel a need to use an ORM, but this one seems to be the most popular among those Android developers that use one.http://ormlite.com/

greenDAO

greenDAO is specifically designed for Android. Developers have said that they are 2-4X faster than OrmLite. You have to programmatically declare your objects in a separate project and greenDAO will generate your entities and DAO classes, so there is a bit of developer overhead. http://greendao-orm.com/

 

JSON Mapping 

If you're not getting your data from your DB, you're most likely accessing a web service to get your data, and in the mobile space, there's a good chance it's coming to you in JSON. Here are some tools to help map you JSON Object with your JAVA class.

GSON

The folks over at Google put this together. If your variables match your JSON , it pretty much works right out of the box, but you can use annotations to map things if you don't have a perfect match.https://code.google.com/p/google-gson/

Jackson

The JAVA library typically used for JSON parsing in the enterprise. The biggest drawback from the Android perspective is the size of library, especially compared to GSON. http://wiki.fasterxml.com/JacksonHome

Spring-Android  

Contains the RestTemplate that normal Spring users may be familiar with. It uses GSON to do the marshalling/unmarshalling. In my experience, it didn't provide any readability improvements or make the code more maintainable than just using GSON directly. http://www.springsource.org/spring-android

 

Widgets

In developing Android applications, there are some specific UI issues that come about that have been solved before and here are some ones that have good support and are quite popular.

ActionBarSherlock

Google introduced the ActionBar in Honeycomb(3.0), but they never back ported it.  Developer Jake Wharton created ActionBarSherlock so developers can bring that design paradigm to Android devices < 3.0, which due to poor update policies among carriers, is still a sizable market.http://actionbarsherlock.com/

ViewPagerIndicator

We've all seen this before, though we may not have known what it was called. The dots at the bottom of the screen identifying the screen you're on, or the navigation at top of the Google Play Store, this library provides the tools to add those elements to a ViewPager. http://viewpagerindicator.com/

Android-BitmapCache

A common task to accomplish in Android applications is to download images from the web for display within an app. This library from Chris Banes does the work of caching that image for the developer.https://github.com/chrisbanes/Android-BitmapCache

Crouton

Android's Toast notifications are not context-sensitive, Crouton is. https://github.com/keyboardsurfer/Crouton

The beauty of the Android space is that it is open source, so there are developers creating libraries every day that help the rest of us out on a daily basis.  I picked the ones above because they were libraries that solved problems that I typically solved with open source libraries in the J2E space.

Share: