Make Your Codes Readable & Well-maintained With Android Annotations

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

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.