Android Annotations - cleans your code
Did you ever find yourself starting a new project or even a new activity and going through all the tiring process off binding UI controls to XML elements such as TextView,EditTexts,ListView etc.. ? I know I did. but there's a solution for this, along with some other code shortening elements for us to use.
presenting : Android Annotations - http://androidannotations.org/
A free to use library which can be added quite easily to an Android project with some minor calibrations.
what does it allow us to do ?
(taken from the androidannotations website)
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 perf impact!
here you'll find a simple guide on how to set up you Android project to compile with the notations library (some build and compile settings, not too serious).
how does it work?
The standard android code is being generated at compile time with some extra processing of the annotations library, so it's basically a short way to write your code faster and letting the notations do the dirty work for you resulting in a lean form of code which will allow you to focus on logic rather than tedious binding and threading definitions etc..
Give it a try, you'll probably get used to it and use this library in all your projects.
Small remark: don't forget to rename your activities at the manifest, for example:
MyActivity -> MyActivity_
this cookbook holds all the info you'll need in order to get the maximum from the annotations library.
good luck !
presenting : Android Annotations - http://androidannotations.org/
A free to use library which can be added quite easily to an Android project with some minor calibrations.
what does it allow us to do ?
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 perf impact!
Comments