Android Annotation(AA) is framework that facilitate the writing and the maintenance of Android Applications, and greatly simplifies the code. It generates subclasses at compile time, for example, the subclass of the MainActivity class would be MainActivity_. To understand how the AA works, you can have a look at the subclass of the Activity.
How to enhance Android Code with AA
I would like to discuss the common annotations that would be used in Android Development.
Add @EActivity with layout id at the top of the class to replace setContentView of the Activity Class
1 2 | |
Add @ViewById to replace findViewById
1 2 | |
Add @Bean to inject the activity context into class
1 2 | |
Add @AfterView before method to do something after view injection, for example, setText, setBackground, etc..
1 2 | |
Add @Click method with view’s id to handle OnClickListener.
1 2 | |
That’s it. There is no need to do “findViewById” to get the view then followed by setOnClickListener.
Want to run a thread? Add @Background above the method
1 2 | |
Initiate the Layoutinflator using @SystemService
1 2 | |
Add EBean at the top of the CLass in order to use available annotations
1 2 | |
Add @RootContext to inject the context into the class
1 2 | |



When user clicks on the one of the movies in the listview, there will be a pop-up screen and
shows the user the overview of the movie.
When the user selects movie, the position of the selected movie in listview is recorded. Therefore,
once the user clicks on the menu, there are two options that allow user to choose: Imdb cover image
and Imdb URL.









