forked from androidannotations/androidannotations
-
Notifications
You must be signed in to change notification settings - Fork 0
Home
pyricau edited this page May 26, 2012
·
49 revisions
- Simplified threading model: annotate your methods to ensure they'll be executed on the UI thread or on a background thread.
- Event binding: annotate methods to handle events on views, no more ugly anonymous listener classes!
- Dependency injection: inject views, extras, system services, resources, and even custom objects and let AndroidAnnotations take care of the details.
- Rest client: define a client interface with a few annotations, and AndroidAnnotations takes care of the implementation details.
- AndroidAnnotations provides those good things and even more for less than 50kb, without any runtime perf impact!
- Convinced? Get started!
- Curious? Read how it works
- Need proofs? See the apps already using AndroidAnnotations
- Looking for recipes? Read the cookbook
#Is your Android code easy to write, read, and maintain?
@EActivity(R.layout.translate) // Sets content view to R.layout.translate
public class TranslateActivity extends Activity {
@ViewById // Injects R.id.textInput
EditText textInput;
@ViewById(R.id.myTextView) // Injects R.id.myTextView
TextView result;
@AnimationRes // Injects android.R.anim.fade_in
Animation fadeIn;
@Click // When R.id.doTranslate button is clicked
void doTranslate() {
translateInBackground(textInput.getText().toString());
}
@Background // Executed in a background thread
void translateInBackground(String textToTranslate) {
String translatedText = callGoogleTranslate(textToTranslate);
showResult(translatedText);
}
@UiThread // Executed in the ui thread
void showResult(String translatedText) {
result.setText(translatedText);
result.startAnimation(fadeIn);
}
// [...]
}14/06/2012 The 2.6 release is out
- Get started!
- Cookbook, full of recipes
- List of all available annotations
- Release Notes
- Examples
- Read the FAQ
- Join the Mailing list
- Create an issue
- Tag on Stack Overflow