What is GreenDroid ?
GreenDroid is a development library for the Android platform. It makes UI developments easier and consistent through your applications. It makes it easier to implement action bar, quick actions and more.
The main purpose of GreenDroid:
- Prevent loosing time at copying the same snippets of code over and over again.
- Try to make Android applications alike.
- Help developers to code highly functional applications.
- Leverage the power of the Android framework.
- Use as much XML as possible.
GreenDroid documentation is available online at http://greendroid.cyrilmottier.com.
- Eclipse IDE 3.6
- Android SDK 4 (android-4)
- Android Development Tools (ADT) 8.0.1
How to use GreenDroid:
- Download the GreenDroid Library from: https://github.com/cyrilmottier/GreenDroid and extract it.
- You will see 3 folders in extracted file.
- GDCatalog– The sample application.
- GreenDroid– The core library.
- GreenDroid-GoogleAPIs- GreenDroid’s extension including Google APIs related features (GDMapActivity for instance)
- Import GreenDroid and GreenDroid-GoogleAPIs folders into your eclipse from
File->Import->Android->Existing Android CodeInto Work space.
Note: Don’t forget to check IsLibrary option is checked or not, it must be checked. To check it, go to both the project properties and check this option.
- Also import the GDCatalog project from
File->Import->General->Existing Projects into Work-space.
- Now next step is to set the Project Build Target of both the library and GDCatalog project sample.
- First Go to GreenDroid-GoogleAPIs properties, In the Project Build Target Section check the option of Google APIs Platform=2.2 and API Level=8
- Same as for GreenDroid and GDCatalog.
- Now add GreenDroid Library into GreenDroid-GoogleAPIs Library and then add GreenDroid-GoogleAPIs Library into your app as Library.
- Now clean all the project and re-build it.
- Now run the GDCatalog sample application. You will see output like this:
In the above samples various functionality provided such as Basic Items, XML Items, Tweaked ItemViews, Segmented Bar, ActionBarActivity, QuickAction,Simple AsyncImageView, AsyncImageView in ListView,MapPinDrawable, PagedView and PageIndicator. You can use it as individual in your app also.
Some Important Note:
- By default, the GreenDroid theme inherits from @android:style/Theme. If your project inherits from a different theme, you’ll have to modify the GreenDroid library on your own. Open the res/values/gd_themes.xml and replace the parent theme @android:style/Theme with your own theme.
- In your
AndroidManifest.xml, go to the application tag and add
android:theme="@style/Theme.GreenDroid"as a new attribute.
- In case you want to use some Google APIs features, make sure you are using the GreenDroid-GoogleAPIs library. GreenDroid-GoogleAPIs is based on GreenDroid. As a result, you don’t need to link GreenDroid as an Android library to your project.
If you have found this Tutorial useful please share it in your circle.
For any trouble with the code. Don’t forget to put the comment.