android annotations and roboguice

12
AndroidAnnotations RoboGuice Android programing frameworks By: Joel Sticha

Upload: joel-sticha

Post on 22-Nov-2014

4.526 views

Category:

Education


3 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Android Annotations and RoboGuice

AndroidAnnotationsRoboGuiceAndroid programing frameworks

By: Joel Sticha

Page 2: Android Annotations and RoboGuice

AndroidAnnotationsAndroidAnnotations was created by Pierre-Yves Ricau

and is sponsored by eBusinessInformations.

Page 3: Android Annotations and RoboGuice

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.

Page 4: Android Annotations and RoboGuice

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!

Page 5: Android Annotations and RoboGuice

Is your Android code easy to write, read, and Maintain?

Page 6: Android Annotations and RoboGuice

Applications already using AndroidAnnotations:

https://github.com/excilys/androidannotations/wiki/Apps-using-AndroidAnnotations

Page 7: Android Annotations and RoboGuice

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_

Page 8: Android Annotations and RoboGuice

RoboGuiceDependency Injection for Android

Current Version is 2.0

Page 9: Android Annotations and RoboGuice

What RoboGuice Does

RoboGuice is a dependency injection framework for Android

It uses the Google Guice framework as the backbone

Page 10: Android Annotations and RoboGuice

Classic android

Page 11: Android Annotations and RoboGuice

Class with RoboGuice

Page 12: Android Annotations and RoboGuice

Example Program