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 trialjenyufu
3,311 PointsChallenge 3 of 3 not working for me?
Let's inject one more view. Inject an ImageView member variable. Name it mMovieImage and again use the ID from the layout file for the ImageView.
This is what I wrote, don't know what I did wrong.
MainActivity.java
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.ImageView;
public class MovieActivity extends Activity {
@InjectView(R.id.movieTitle) TextView mTitleLabel;
@Injectview(R.id.movieImage) ImageView mMovieImage;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_movie);
ButterKnife.inject(this);
// The rest of the code is omitted for brevity :)
}
}
activity_movie.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white" >
<TextView
android:id="@+id/movieTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="32sp"
android:text=""
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" />
<ImageView
android:id="@+id/movieImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@id/movieTitle" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/movieTitle"
android:layout_centerHorizontal="true"
android:id="@+id/linearLayout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text=""
android:id="@+id/textView"
android:layout_weight="1"
android:gravity="left" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text=""
android:id="@+id/textView2"
android:layout_weight="1"
android:gravity="right" />
</LinearLayout>
</RelativeLayout>
this is the error report:
/MovieActivity.java:9: error: cannot find symbol @Injectview(R.id.movieImage) ImageView mMovieImage; ^ symbol: class Injectview location: class MovieActivity 1 error
5 Answers
Jon Kussmann
Courses Plus Student 7,254 PointsHi,
This is a difficult to see error, but if you look closely at "InjectView" for your ImageView, you have a lower case "v" instead of an upper case "V".
Let me know if you have any more questions!
Tichaona Mudzuri
6,373 PointsThank you Jenyufu,you smoothened my progress.Be blessed.
jenyufu
3,311 PointsYour welcome! Just be sure to help other people too when you get the chance.
Aaron Miller
5,911 Points***************ITS @BindView now****************************
Tichaona Mudzuri
6,373 PointsCan you help guys! What's the answer for task 3?
jenyufu
3,311 PointsIts this:
MainActivity.java
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.ImageView;
public class MovieActivity extends Activity {
@InjectView(R.id.movieTitle) TextView mTitleLabel;
@InjectView(R.id.movieImage) ImageView mMovieImage; //<- I had forgotten to capitalize the 'V' in InjectView
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_movie);
ButterKnife.inject(this);
// The rest of the code is omitted for brevity :)
}
}
activity_movie.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white" >
<TextView
android:id="@+id/movieTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="32sp"
android:text=""
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" />
<ImageView
android:id="@+id/movieImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@id/movieTitle" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/movieTitle"
android:layout_centerHorizontal="true"
android:id="@+id/linearLayout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text=""
android:id="@+id/textView"
android:layout_weight="1"
android:gravity="left" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text=""
android:id="@+id/textView2"
android:layout_weight="1"
android:gravity="right" />
</LinearLayout>
</RelativeLayout>
NDUMISO MZAMANI SITHOLE
8,650 PointsI even copy and pasted but still not passing