Butter Knife
Useful library that allows to find and automatically cast the corresponding views like buttons or textviews from layouts to Java objects using annotattions.
http://jakewharton.github.io/butterknife/
In case you have any problems, set debug mode for Butter Knife.
ButterKnife.setDebug(true);
If you an error like the following it indicates annotation may not be working correctly.
D/ButterKnife: Not found. Trying superclass android.support.v4.app.Fragment
Remember to add android-apt to your project build.gradle:
buildscript {
repositories {
...
}
dependencies {
...
// Required for annotation processing
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
And the folowing lines to your dependencies in module build.gradle:
dependencies {
// Butter Knife support
compile 'com.jakewharton:butterknife:8.3.0'
apt 'com.jakewharton:butterknife-compiler:8.3.0'
}