Library: Butter Knife

After deploying the first version of my app, I discovered the Butter Knife (Copyright 2013 Jake Wharton) which is a really usefull library.

The main purpose of this library is to make it easier to construct the inflate process of view so you can focus on your app code. With Butter Knife you make annotations to your views and let the lib inflate view and assign control instances to your variables.

So, instead of this code

You can use this:

Several other features are implemented in the library like optional injection (if the control was not found it sets the variable to null)

Also you can assign automatically listeners:

You can find more usefull information on features and how to install Butter Knife at the developer website.

Another usefull tool is Android ButterKnife Zelezny that you can add to your Android Studio as a plugin that make it really fast to add the Butter Knife injection,