Monday, January 04, 2016

Use "ButterKnife" to make your life easier

Easiest way to bind an Android view to the class file is to use "ButterKnife". No more long findViewById()
Using "Butterknife" is as simple as the name suggests :)
  • On your app's build.gradle, add "compile 'com.jakewharton:butterknife:7.0.1"
  • To bind  a view element in the class, simply use 
    • @Bind( Button btnSubmit; 
  • After setContentView(R.layout.blah_blah_activity); 
    • ButterKnife.bind(this);
For more information

No comments: