Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

What exactly is the advantage of using Butterknife for Android?

I'm doing the Android Course where we build a Weather app, and we use Butterknife in it. I'm definitely going to use it since Ben says it is way better than not using it. I was just wondering though, if I was to not use Butterknife, what would I have to do differently and why would it be not as cool as using Butterknife?

1 Answer

Ben Deitch
STAFF
Ben Deitch
Treehouse Teacher

It's just a convenience thing. ButterKnife only uses one line to populate a View field, whereas normally you'd have to use two. Multiply that by all of your View fields, and it starts to add up!

@BindView(R.id.title) TextView title;

vs

TextView title;
title = (TextView)findViewById(R.id.title); // in onCreate

Okay, I get it now. It really helps me understand things when I can see the exact difference in code that occurs. Amazing, thanks Ben!