Lazy but productive Android Developer (Part-3)
There is so much boilerplate code in Android Activity, so if there is a way to eliminate it then we can just focus on our business logic. There are so many projects the relieve developers from this pain but the main difference between them is; some generate code at compile time (no performance impact) and some generate code on the fly using Reflection, that is very slow and increases the chances of app crashing.
There are so many benefits of using Android Annotations, one of the benefit is you need to write less code and absolutely less bugs, less development, maintenance time spent and improved stability. The technique used by these libraries is called Dependency Injection.
Android Annotations can also relieve you from another big pain of requesting some code to run on UI Thread or on Background Thread and it’s also very efficient because it maintains a pool of threads. So you just need to use annotation for e.g. @UiThread or @background
@Eactivity Specifies layout file associated with specific activity
@ViewById Associates layout components with Java variables so that it can referenced from Java code.
@Click associate the click functionality of layout components to java method
To associate, multiple components’s click to only 1 Java method, we can write something like this:
(1) Fragment @EFragment
(2) Service @EService
(3) BroadcastReceiver @EReceiver
(4) Application @EApplication
(5) ContentProvider @EProvider
(6) NotificationManager @SystemService
(7) Object @Bean
(8) MyRestClient @RestService
(9) Transaction support in Database Operations @Transactional
Need a translation service?
Please enter your personal details and we will contact you shortly
Words translated by CCJK146,096,379
Over 95% of our clients recommend our language services to others