Here’s how to use Java Annotations in your Android code to make the code have better readability and maintenance.
Most Java programmers are already familiar with Java annotations. Java annotations are used to provide meta data for your Java code.
Java annotations are typically used for the following purposes:
- Compiler instructions
- Build-time instructions
- Runtime instructions
Android programmers also use android annotations. Some of android annotations used are override, nullable, SuppressWarnings , etc.
Android programmers almost spend 20% of time their time on following task given below:
- find the android ui element by id
- Associates the layout with activity, fragment or ViewGroups.
- Associating the Variables with String resource or other resources.
- SetClick handler for listview or other element.
Consider the case where you have large code base and people have defined about 20-30 variables. It will be nightmare for any developer to determine which ui element associates with which variable activity or fragments.
Here is an example of using android annotations, so that we can…
View original post 68 more words