As I have gone over the fundamentals of the Commonsware series and found Android Annotations fascinating. I took one of the series app demos and converted it into an Android Annotation demo.
What I learned from this exercise:
- Make sure to read thoroughly the documentation assuming from its intro the framework is easy to replace. I bumped myself a few times with their SharedPreferences injections. Best if you test your injections in a dummy activity.
- The commonsware example has at times fragment-activities just adding fragments using the ID (R.id.content). For this to work with @fragment injections, I had to set the fragment-activity to have set a plain layout. See more at SimpleContentActivity
- I had to look twice at referencing Services and Broadcast Receivers because you will see errors by the time you compile. Since the framework does its magic by the subclasses it creates. Even though, You are immediately told by Manifest.xml file when you are not referencing a subclass. Keep in mind subclasses are named the same except they have appended an underscore character.
- I felt at times I was writing in another language, but I found this approach more elegant. I really enjoyed replacing AsyncTask classes with injections of @background and @uithreads
- I feel tired after spending a good amount of time doing this. But it was a great learning lesson, and I think I learned more replacing than doing examples from scratch.