Yesterday we studied the use of Volley network communication framework, and today we have studied the Android annotations framework, and found that Android annotations framework really can reduce the amount of code.
Android Annotations is an open-source framework for accelerating the development of Android applications, allowing you to focus on the implementation of functionality, simplifying code, and improving maintainability.
Function module:
1. Using Dependency Injection (Dependency injection)
---------------------------------------------------------------------------------------
2. Simplified threading models (simplified threading model)
---------------------------------------------------------------------------------------
3. Event Binding
---------------------------------------------------------------------------------------
4. REST Client
---------------------------------------------------------------------------------------
5. No Magic
Pros: Full annotations make it easier to develop and programmers write less code.
The following is a simple example.
@NoTitle//Cancel title @fullscreen//full Screen @eactivity (R.layout.activity_main)// Layout file to change mainactivity in Androidmanifest.xml to Mainactivity_public class Mainactivity extends Activity {// Call string resource @stringresstring Hello_world; @StringRes (r.string.action_settings) string setting;// Findviewbyid variable name to match the control name @viewbyidtextview textView1; @AfterViewsvoid init () {Textview1.settext ("");} Click on the event method name to match the control name @clickvoid button1clicked () {Textview1.settext ("click" + Hello_world);} @LongClickvoid button1longclicked () {Textview1.settext ("long click" + setting);}}
In the example, I give a detailed comment. This is a few simple applications are also the most used. Please refer to the official documentation for more information on how to use.
Github: Click to open link
There are detailed usage methods and configuration methods on GitHub, including Eclipse and Android studio and methods.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Android-developed Android annotations framework