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 trialShagun Goel
2,297 PointsInjecting TextView error
./MovieActivity.java:15: error: annotation type not applicable to this kind of declaration @InjectView(R.id.movieTitle) TextView mTitleLabel;
Not entirely sure why I'm getting this error.
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.ImageView;
public class MovieActivity extends Activity {
// @InjectView here ...
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_movie);
ButterKnife.inject(this);
@InjectView(R.id.movieTitle) TextView mTitleLabel; // not here!
// The rest of the code is omitted for brevity :)
}
}
1 Answer
Steve Hunter
57,712 PointsHi Shagun,
You want to put the @InjectView
outside of onCreate
- I've added a comment in your code.
Steve.
Shagun Goel
2,297 PointsShagun Goel
2,297 PointsAh yes of course! Thank you for your help! :D
Steve Hunter
57,712 PointsSteve Hunter
57,712 PointsHey, no problem! :-)