android annotations and roboguice
DESCRIPTION
TRANSCRIPT
AndroidAnnotationsRoboGuiceAndroid programing frameworks
By: Joel Sticha
AndroidAnnotationsAndroidAnnotations was created by Pierre-Yves Ricau
and is sponsored by eBusinessInformations.
Why use android annotations?
Goals
We want to facilitate the writing and maintenance of android applications
Android Annotations strives to achieve these goals by making code simple to understand with clear intents
Robert C. Martin (Uncle Bob)
"The ratio of time spent reading [code] versus writing is well over 10 to 1 [therefore] making it easy to read makes it easier to write."
Using Java annotations, developers can show their intent and let AndroidAnnotations generate the plumbing code at compile time.
Features of AndroidAnnotations
Dependency injection: inject views, extras, system services, resources, ...
Simplified threading model: annotate your methods so that they execute on the UI thread or on a background thread.
Event binding: annotate methods to handle events on views, no more ugly anonymous listener classes!
REST client: create a client interface, AndroidAnnotations generates the implementation.
AndroidAnnotations provide those good things and even more for less than 50kb, without any runtime performance impact!
Is your Android code easy to write, read, and Maintain?
Applications already using AndroidAnnotations:
https://github.com/excilys/androidannotations/wiki/Apps-using-AndroidAnnotations
Android Annotations bottom line
It takes out the most repetitive code in your application
It helps you create cleaner code that is easier to read
It can be included with small changes to your project and editing environment
Add two jar files to the Java Build Path for your project.
Add AndroidAnnotations as a annotation processor in the Java Compiler Settings
Rename the activities to xxxx_
RoboGuiceDependency Injection for Android
Current Version is 2.0
What RoboGuice Does
RoboGuice is a dependency injection framework for Android
It uses the Google Guice framework as the backbone
Classic android
Class with RoboGuice
Example Program