Green Droid!?  What's that?green-droid.png

Green Droid is a great library by Cyril Mottier.  It has a number of widgets that make life easier for Android developers.  Have you ever tried making a ListView with a custom list item?  If so, you know how tricky that can be.  Green Droid makes that easy.  I sought Green Droid because I wanted the Quick Action widget.  This is that famous widget that the Twitter App made popular.  In the following image, you can see Green Droid's Action Bar and Quick Action Grid.

quick-action.jpg

 

Getting Started...

The entry is all about getting started.  Don't worry...it's easy  BTW, this approach works for any "Android Library,"not just Green Droid.

First, download Green Droid from here.  (I just grabbed the zip file).  Once you have it on your system, startup Eclipse. 

Import the Projectgreendroid_import.jpg

From the main menu, select File -> Import.  Under the General item, select "Existing Projects into Workspace" as shown below.

Click Next.

 

On the next page, make sure "Select root directory" is selected and then use the Browse button to navigate to where you installed Green Droid. 

Do Not load the project in the root directory.  That will mess up all of the references.

If you are using the Google APIs, make sure that you choose the project under GreenDroid-GoogleAPIs.  Otherwise, just select GreenDroid.

We're almost done.

Connect Green Droid to your Project

Open up the Properties on your project and select the Android item in the left window.  On the right side, you should have all of the different choices for which Android platform you are using.  At the bottom, there is a smaller box called "Library." 

Click the "Add" button.greendroid_chooselibrary.jpg

A dialog containing Green Droid should pop up.  Select Green Droid, hit OK, hit OK once more, and you are done!

 

Almost Done

It turns out, this is not enough to make GreenDroid work.  At this time, it is compulsory to the GreenDroid theme as the basis for your application.  You can easily do this by going to the application's manifest, selecting the Application tab, and then putting "@style/Theme.GreenDroid" in the Theme field. 

This step really bugged me because I kept trying to browse the themes and nothing was showing up - at least, nothing I could select.  Don't worry, the application will find it.  You can verify this by putting an erroneous value in the box - it doesn't work.

One more thing. If you intend to use the GreenDroid Action Bar (i.e. you activities extend GDActivity instead of Activity), you need to ensure the application is a "GDApplication".  Fortunately, this is something else that can be done in the manifest.  In the Name field, simple add "greendroid.app.GDApplication".  This is not necessary to simply use the Quick Action widget.

In the next article, I hope to share a simple example of using the Quick Action Bar! 

Comments:

You must be logged in to leave a reply. Login »