From the course: Android Development Tips

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Manage view components with Butter Knife

Manage view components with Butter Knife - Android Tutorial

From the course: Android Development Tips

Manage view components with Butter Knife

- [Instructor] Android developers are always looking for a way to get their work done with less code. Getting references to view object and setting up event handlers takes a good bit of boilerplate code and you very quickly start wondering if there's a better way. There's a popular open source library named ButterKnife. It's available at this web page. The purpose of ButterKnife is to streamline your code, moving away from the use of the findViewById method and toward the use of annotations. To get started with ButterKnife, go to this page and scroll all the way down to the bottom. Under the Download section, under Gradle, select and copy these two declarations. Then go back to Android Studio and open your Gradle build file for your app module. Paste those declarations at the bottom and then re-sync Gradle. ButterKnife is now available to your application. In the main activity class of this application there are two view references, one for a TextView and the other for a…

Contents